Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_exportthirdparty
This commit is contained in:
commit
2f138c0c37
21
ChangeLog
21
ChangeLog
@ -2,15 +2,6 @@
|
|||||||
English Dolibarr ChangeLog
|
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.* *****
|
***** 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 the event BILL_PAYED to the list of supported events for module notification.
|
||||||
NEW: Add total weight and volume on PDF.
|
NEW: Add total weight and volume on PDF.
|
||||||
NEW: Add hidden option to hide column qty ordered on shipments.
|
NEW: Add hidden option to hide column qty ordered on shipments.
|
||||||
NEW: Add view of virtual stock into product list (when appropriate).
|
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 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 weight/volume for one product into shipment export
|
||||||
NEW: Add width and height on product card
|
NEW: Add width and height on product table
|
||||||
NEW: allow a document to be linked to project of another customer by config setup.
|
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: 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: 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 dynamically number of records visible into lists.
|
||||||
NEW: Can change type of extrafields (for some combinations only).
|
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>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td colspan="2">';
|
print '<td class="liste_titre center" colspan="2">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -200,14 +200,13 @@ else {
|
|||||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
|
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre center"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre center"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre center"> </td>';
|
||||||
|
|
||||||
print '<td align="right" class="liste_titre">';
|
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")) . '">';
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print ' ';
|
print $searchpitco;
|
||||||
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")) . '">';
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -386,7 +386,7 @@ print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" al
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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 '<td class="liste_titre center">';
|
||||||
print $langs->trans('From') . ': ';
|
print $langs->trans('From') . ': ';
|
||||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||||
@ -394,15 +394,15 @@ print '<br>';
|
|||||||
print $langs->trans('to') . ': ';
|
print $langs->trans('to') . ': ';
|
||||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
print '<td class="liste_titre center"><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||||
print '<td>';
|
print '<td class="liste_titre center">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print $langs->trans('to');
|
print $langs->trans('to');
|
||||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td class="liste_titre center">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -412,10 +412,10 @@ print '</td>';
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre center"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre center"> </td>';
|
||||||
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></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 align="right" class="liste_titre">';
|
print '<td class="liste_titre center" align="right">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -190,14 +190,14 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$row = $this->db->fetch_object($resql);
|
$row = $this->db->fetch_object($resql);
|
||||||
if ($row->nb == 0) {
|
if ($row->nb == 0)
|
||||||
|
{
|
||||||
// Determine piece_num
|
// Determine piece_num
|
||||||
$sqlnum = "SELECT piece_num";
|
$sqlnum = "SELECT piece_num";
|
||||||
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
|
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'"; // For example doc_type = 'bank'
|
||||||
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
|
$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 . "'";
|
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'"; // ref of source object
|
||||||
$sqlnum .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
$sqlnum .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||||
@ -276,13 +276,13 @@ class BookKeeping extends CommonObject
|
|||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$result = 0;
|
$result = 0;
|
||||||
} else {
|
} else {
|
||||||
$result = - 2;
|
$result = -2;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 1;
|
$result = -1;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
@ -290,11 +290,11 @@ class BookKeeping extends CommonObject
|
|||||||
} else { // Already exists
|
} else { // Already exists
|
||||||
$result = -3;
|
$result = -3;
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = 'Error Transaction for ('.$this->doc_type.', '.$this->doc_ref.', '.$this->fk_docdet.') were already recorded';
|
$this->error='BookkeepingRecordAlreadyExists';
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_WARNING);
|
dol_syslog(__METHOD__ . ' ' . $this->error, LOG_WARNING);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 5;
|
$result = -5;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
@ -316,11 +316,9 @@ class BookKeeping extends CommonObject
|
|||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
return -1 * $error;
|
||||||
return - 1 * $error;
|
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,6 +87,7 @@ class FormVentilation extends Form
|
|||||||
if ($usecache && ! empty($this->options_cache[$usecache]))
|
if ($usecache && ! empty($this->options_cache[$usecache]))
|
||||||
{
|
{
|
||||||
$options = $this->options_cache[$usecache];
|
$options = $this->options_cache[$usecache];
|
||||||
|
$selected=$selectid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -153,7 +153,8 @@ if ($result) {
|
|||||||
// one line for bank jounral = tabbq
|
// one line for bank jounral = tabbq
|
||||||
// one line for thirdparty journal = tabtp
|
// one line for thirdparty journal = tabtp
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num )
|
||||||
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// Set accountancy code (for bank and thirdparty)
|
// Set accountancy code (for bank and thirdparty)
|
||||||
@ -314,7 +315,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
if (! $errorforline)
|
if (! $errorforline)
|
||||||
{
|
{
|
||||||
// Line into bank account
|
// Line into bank account
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
|
{
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -363,9 +365,18 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||||
$errorforline++;
|
{
|
||||||
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
|
$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 = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
|
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
@ -633,6 +634,15 @@ if ($action == 'export_csv') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
if (empty($action) || $action == 'view') {
|
if (empty($action) || $action == 'view') {
|
||||||
$invoicestatic = new Facture($db);
|
$invoicestatic = new Facture($db);
|
||||||
$invoicesupplierstatic = new FactureFournisseur($db);
|
$invoicesupplierstatic = new FactureFournisseur($db);
|
||||||
@ -689,7 +699,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
print "<td>" . $langs->trans("AccountAccounting") . "</td>";
|
||||||
print "<td>" . $langs->trans("Type") . "</td>";
|
print "<td>" . $langs->trans("Type") . "</td>";
|
||||||
print "<td>" . $langs->trans("PaymentMode") . "</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";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
@ -721,7 +732,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$sqlmid = 'SELECT payfac.fk_facture as id';
|
$sqlmid = 'SELECT payfac.fk_facture as id';
|
||||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac";
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac";
|
||||||
$sqlmid .= " WHERE payfac.fk_paiement=" . $val["paymentid"];
|
$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);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
@ -735,7 +746,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id';
|
$sqlmid = 'SELECT payfac.fk_facturefourn as id';
|
||||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac";
|
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac";
|
||||||
$sqlmid .= " WHERE payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
|
$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);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
@ -750,8 +761,8 @@ if (empty($action) || $action == 'view') {
|
|||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
$invoicestatic->type = $val["type"];*/
|
$invoicestatic->type = $val["type"];*/
|
||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
|
{
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
@ -809,7 +820,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("WaitAccountNotDefined").'</span>';
|
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>";
|
||||||
print "<td>" . $reflabel . "</td>";
|
print "<td>" . $reflabel . "</td>";
|
||||||
print "<td> </td>";
|
print "<td> </td>";
|
||||||
|
|||||||
@ -187,11 +187,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
// Fees
|
// Fees
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
if ($accountingaccount->fetch(null, $k)) {
|
if ($accountingaccount->fetch(null, $k, true)) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -355,7 +355,7 @@ if ($action == 'export_csv') {
|
|||||||
// Fees
|
// Fees
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
@ -464,7 +464,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Fees
|
// Fees
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print "<tr " . $bc[$var] . " >";
|
print "<tr " . $bc[$var] . " >";
|
||||||
|
|||||||
@ -219,11 +219,11 @@ if ($action == 'writebookkeeping') {
|
|||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
if ($accountingaccount->fetch(null, $k)) {
|
if ($accountingaccount->fetch(null, $k, true)) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -398,7 +398,7 @@ if ($action == 'export_csv') {
|
|||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
@ -518,7 +518,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print "<tr " . $bc[$var] . " >";
|
print "<tr " . $bc[$var] . " >";
|
||||||
|
|||||||
@ -243,7 +243,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
if ($mt) {
|
if ($mt) {
|
||||||
// get compte id and label
|
// get compte id and label
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
if ($accountingaccount->fetch(null, $k)) {
|
if ($accountingaccount->fetch(null, $k, true)) {
|
||||||
$bookkeeping = new BookKeeping($db);
|
$bookkeeping = new BookKeeping($db);
|
||||||
$bookkeeping->doc_date = $val["date"];
|
$bookkeeping->doc_date = $val["date"];
|
||||||
$bookkeeping->doc_ref = $val["ref"];
|
$bookkeeping->doc_ref = $val["ref"];
|
||||||
@ -375,7 +375,7 @@ if ($action == 'export_csv') {
|
|||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount_static = new AccountingAccount($db);
|
$accountingaccount_static = new AccountingAccount($db);
|
||||||
if ($accountingaccount_static->fetch(null, $k)) {
|
if ($accountingaccount_static->fetch(null, $k, true)) {
|
||||||
print $date . $sep;
|
print $date . $sep;
|
||||||
print $sell_journal . $sep;
|
print $sell_journal . $sep;
|
||||||
print length_accountg(html_entity_decode($k)) . $sep;
|
print length_accountg(html_entity_decode($k)) . $sep;
|
||||||
@ -429,7 +429,7 @@ if ($action == 'export_csv') {
|
|||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
@ -559,7 +559,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
$accountingaccount = new AccountingAccount($db);
|
||||||
$accountingaccount->fetch(null, $k);
|
$accountingaccount->fetch(null, $k, true);
|
||||||
|
|
||||||
if ($mt) {
|
if ($mt) {
|
||||||
print "<tr " . $bc[$var] . ">";
|
print "<tr " . $bc[$var] . ">";
|
||||||
|
|||||||
@ -35,9 +35,10 @@ class AdherentType extends CommonObject
|
|||||||
{
|
{
|
||||||
public $table_element = 'adherent_type';
|
public $table_element = 'adherent_type';
|
||||||
public $element = 'adherent_type';
|
public $element = 'adherent_type';
|
||||||
|
public $picto = 'group';
|
||||||
|
|
||||||
/** @var string Label */
|
/** @var string Label */
|
||||||
public $libelle;
|
public $label;
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
* @deprecated Use subscription
|
* @deprecated Use subscription
|
||||||
@ -199,7 +200,7 @@ class AdherentType extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid)
|
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 .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||||
$sql .= " WHERE d.rowid = ".$rowid;
|
$sql .= " WHERE d.rowid = ".$rowid;
|
||||||
|
|
||||||
@ -214,7 +215,8 @@ class AdherentType extends CommonObject
|
|||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $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->statut = $obj->statut;
|
||||||
$this->subscription = $obj->subscription;
|
$this->subscription = $obj->subscription;
|
||||||
$this->mail_valid = $obj->mail_valid;
|
$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
|
* 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['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['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']['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_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_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.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);
|
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
|
// Extra fields
|
||||||
@ -434,32 +434,32 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
|||||||
if (! empty($arrayfields['d.ref']['checked']))
|
if (! empty($arrayfields['d.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
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>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($arrayfields['d.firstname']['checked']))
|
if (! empty($arrayfields['d.firstname']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.lastname']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.company']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.login']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.morphy']['checked']))
|
||||||
@ -479,24 +479,24 @@ if (! empty($arrayfields['t.libelle']['checked']))
|
|||||||
if (! empty($arrayfields['d.address']['checked']))
|
if (! empty($arrayfields['d.address']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.zip']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.town']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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
|
// State
|
||||||
if (! empty($arrayfields['state.nom']['checked']))
|
if (! empty($arrayfields['state.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
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>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Country
|
// Country
|
||||||
@ -510,25 +510,25 @@ if (! empty($arrayfields['country.code_iso']['checked']))
|
|||||||
if (! empty($arrayfields['d.phone']['checked']))
|
if (! empty($arrayfields['d.phone']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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
|
// Phone perso
|
||||||
if (! empty($arrayfields['d.phone_perso']['checked']))
|
if (! empty($arrayfields['d.phone_perso']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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
|
// Phone mobile
|
||||||
if (! empty($arrayfields['d.phone_mobile']['checked']))
|
if (! empty($arrayfields['d.phone_mobile']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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
|
// Email
|
||||||
if (! empty($arrayfields['d.email']['checked']))
|
if (! empty($arrayfields['d.email']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="left">';
|
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']))
|
if (! empty($arrayfields['d.datefin']['checked']))
|
||||||
@ -597,7 +597,7 @@ print "</tr>\n";
|
|||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
|||||||
@ -298,20 +298,15 @@ if ($rowid > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
|
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>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
dol_banner_tab($object, 'rowid', $linkback);
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
|
||||||
print '<td>';
|
|
||||||
print $form->showrefnav($object, 'rowid', $linkback);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Label
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.dol_escape_htmltag($object->libelle).'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
print yn($object->subscription);
|
print yn($object->subscription);
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -378,9 +373,7 @@ if ($rowid > 0)
|
|||||||
$sql.= " AND t.rowid = ".$object->id;
|
$sql.= " AND t.rowid = ".$object->id;
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
$sql.= " AND (d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe 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);
|
||||||
$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."%')";
|
|
||||||
}
|
}
|
||||||
if ($status != '')
|
if ($status != '')
|
||||||
{
|
{
|
||||||
@ -388,22 +381,22 @@ if ($rowid > 0)
|
|||||||
}
|
}
|
||||||
if ($action == 'search')
|
if ($action == 'search')
|
||||||
{
|
{
|
||||||
if (isset($_POST['search']) && $_POST['search'] != '')
|
if (GETPOST('search'))
|
||||||
{
|
{
|
||||||
$sql.= " AND (d.firstname LIKE '%".$_POST['search']."%' OR d.lastname LIKE '%".$_POST['search']."%')";
|
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($search_lastname))
|
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))
|
if (! empty($search_login))
|
||||||
{
|
{
|
||||||
$sql.= " AND d.login LIKE '%".$search_login."%'";
|
$sql.= natural_search("d.login", $search_login);
|
||||||
}
|
}
|
||||||
if (! empty($search_email))
|
if (! empty($search_email))
|
||||||
{
|
{
|
||||||
$sql.= " AND d.email LIKE '%".$search_email."%'";
|
$sql.= natural_search("d.email", $search_email);
|
||||||
}
|
}
|
||||||
if ($filter == 'uptodate')
|
if ($filter == 'uptodate')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -675,8 +675,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean some parameters
|
// Clean some parameters
|
||||||
if (! empty($_POST["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='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"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='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"] <= 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_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
|
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||||
@ -1064,6 +1064,8 @@ if ($id)
|
|||||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
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 ($id == 2) // Special cas for state page
|
||||||
{
|
{
|
||||||
@ -1784,10 +1786,10 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||||
print '<td><input type="text" class="flat" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
|
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
|
||||||
}
|
}
|
||||||
elseif ($fieldlist[$field]=='unit') {
|
elseif ($fieldlist[$field]=='unit') {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1827,8 +1829,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$size=''; $class='';
|
$size=''; $class='';
|
||||||
if ($fieldlist[$field]=='code') $size='size="8" ';
|
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
|
||||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||||
|
|||||||
@ -500,8 +500,10 @@ if ($mode != 'marketplace')
|
|||||||
else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
|
else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
|
||||||
|
|
||||||
$textexternal='';
|
$textexternal='';
|
||||||
|
$imginfo="info";
|
||||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||||
{
|
{
|
||||||
|
$imginfo="info_black";
|
||||||
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
|
$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 ($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;
|
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.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||||
$text.=$langs->trans("DetectionNotPossible");
|
$text.=$langs->trans("DetectionNotPossible");
|
||||||
|
|
||||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20');
|
||||||
|
|
||||||
print '</td>';
|
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('/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"');
|
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;
|
print $versiontrans;
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
|||||||
|
|
||||||
|
|
||||||
// Translations
|
// Translations
|
||||||
|
$langs->load("admin");
|
||||||
$langs->load("multicurrency");
|
$langs->load("multicurrency");
|
||||||
|
|
||||||
// Access control
|
// 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 '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||||
print '</td></form></tr>';
|
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)
|
foreach ($TCurrency as &$currency)
|
||||||
{
|
{
|
||||||
|
if($currency->code == $conf->currency) continue;
|
||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
|
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="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="update_currency">';
|
print '<input type="hidden" name="action" value="update_currency">';
|
||||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
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("Modify").'"> ';
|
||||||
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
|
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</td></tr>';
|
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 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
|
// Action column
|
||||||
print '<td class="liste_titre" align="middle">';
|
print '<td class="liste_titre" align="middle">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$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)) {
|
if (preg_match("/^type_of_target/", $key)) {
|
||||||
$array_query[$key] = GETPOST($key);
|
$array_query[$key] = GETPOST($key);
|
||||||
}
|
}
|
||||||
@ -203,8 +207,8 @@ if ($action == 'add') {
|
|||||||
$advTarget->thirdparty_lines = array ();
|
$advTarget->thirdparty_lines = array ();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2)) {
|
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);
|
$result = $advTarget->query_contact($array_query, 1);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($advTarget->error, 'errors');
|
setEventMessage($advTarget->error, 'errors');
|
||||||
}
|
}
|
||||||
@ -889,6 +893,11 @@ if ($object->fetch($id) >= 0) {
|
|||||||
dol_include_once('/core/class/extrafields.class.php');
|
dol_include_once('/core/class/extrafields.class.php');
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('socpeople');
|
$extralabels = $extrafields->fetch_name_optionals_label('socpeople');
|
||||||
|
foreach($extrafields->attribute_type as $key=>&$value) {
|
||||||
|
if($value == 'radio')$value = 'select';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ( $extralabels as $key => $val ) {
|
foreach ( $extralabels as $key => $val ) {
|
||||||
|
|
||||||
print '<tr><td>' . $extrafields->attribute_label[$key];
|
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 '<input type="text" name="options_' . $key . '_cnct"/></td><td>' . "\n";
|
||||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
|
||||||
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
|
} 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("AdvTgtMinVal") . '<input type="text" name="options_' . $key . '_min_cnct"/>';
|
||||||
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options' . $key . '_max_cnct"/>';
|
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options_' . $key . '_max_cnct"/>';
|
||||||
print '</td><td>' . "\n";
|
print '</td><td>' . "\n";
|
||||||
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
|
||||||
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
|
||||||
@ -967,12 +976,6 @@ if ($object->fetch($id) >= 0) {
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
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();
|
llxFooter();
|
||||||
|
|||||||
@ -64,16 +64,19 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->select_target_type = array('2'=>$langs->trans('Contacts'),'1'=>$langs->trans('Contacts').'+'.$langs->trans('ThirdParty'),
|
$this->select_target_type = array(
|
||||||
'3'=>$langs->trans('ThirdParty'),
|
'2' => $langs->trans('Contacts'),
|
||||||
);
|
'1' => $langs->trans('Contacts') . '+' . $langs->trans('ThirdParty'),
|
||||||
$this->type_statuscommprospect=array(
|
'3' => $langs->trans('ThirdParty'),
|
||||||
-1=>$langs->trans("StatusProspect-1"),
|
'4' => $langs->trans('ContactsWithThirdpartyFilter')
|
||||||
0=>$langs->trans("StatusProspect0"),
|
);
|
||||||
1=>$langs->trans("StatusProspect1"),
|
$this->type_statuscommprospect = array(
|
||||||
2=>$langs->trans("StatusProspect2"),
|
- 1 => $langs->trans("StatusProspect-1"),
|
||||||
3=>$langs->trans("StatusProspect3"));
|
0 => $langs->trans("StatusProspect0"),
|
||||||
|
1 => $langs->trans("StatusProspect1"),
|
||||||
|
2 => $langs->trans("StatusProspect2"),
|
||||||
|
3 => $langs->trans("StatusProspect3")
|
||||||
|
);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -492,7 +495,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
}
|
}
|
||||||
if (!empty($arrayquery['cust_mothercompany'])) {
|
if (!empty($arrayquery['cust_mothercompany'])) {
|
||||||
$str=$this->transformToSQL('nom',$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) {
|
if (!empty($arrayquery['cust_status']) && count($arrayquery['cust_status'])>0) {
|
||||||
$sqlwhere[]= " (t.status IN (".implode(',',$arrayquery['cust_status'])."))";
|
$sqlwhere[]= " (t.status IN (".implode(',',$arrayquery['cust_status'])."))";
|
||||||
@ -603,9 +606,10 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
* Load object in memory from database
|
* Load object in memory from database
|
||||||
*
|
*
|
||||||
* @param array $arrayquery All element to Query
|
* @param array $arrayquery All element to Query
|
||||||
|
* @param int $withThirdpartyFilter add contact with tridparty filter
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function query_contact($arrayquery)
|
function query_contact($arrayquery, $withThirdpartyFilter = 0)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
@ -614,6 +618,11 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t";
|
$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 ";
|
$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=array();
|
||||||
|
|
||||||
$sqlwhere[]= 't.entity IN ('.getEntity('socpeople',1).')';
|
$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);
|
if (count($sqlwhere)>0) $sql.= " WHERE ".implode(" AND ",$sqlwhere);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::query_contact sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::query_contact sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|||||||
@ -681,6 +681,7 @@ if (empty($reshook))
|
|||||||
$predef='';
|
$predef='';
|
||||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||||
$price_ht = GETPOST('price_ht');
|
$price_ht = GETPOST('price_ht');
|
||||||
|
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||||
if (GETPOST('prod_entry_mode') == 'free')
|
if (GETPOST('prod_entry_mode') == 'free')
|
||||||
{
|
{
|
||||||
$idprod=0;
|
$idprod=0;
|
||||||
@ -712,7 +713,7 @@ if (empty($reshook))
|
|||||||
$error ++;
|
$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');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -858,6 +859,7 @@ if (empty($reshook))
|
|||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
|
|
||||||
$fk_unit = GETPOST('units', 'alpha');
|
$fk_unit = GETPOST('units', 'alpha');
|
||||||
|
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
@ -880,7 +882,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_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) {
|
if ($result > 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -960,6 +962,8 @@ if (empty($reshook))
|
|||||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
$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_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'));
|
$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) {
|
if (! $error) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_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) {
|
if ($result >= 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -1070,17 +1074,17 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Set project
|
// Set project
|
||||||
else if ($action == 'classin' && $user->rights->propal->creer) {
|
else if ($action == 'classin' && $user->rights->propal->creer) {
|
||||||
$object->setProject($_POST['projectid']);
|
$object->setProject(GETPOST('projectid','int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delai de livraison
|
// Delai de livraison
|
||||||
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
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
|
// Origine de la propale
|
||||||
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
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
|
// Conditions de reglement
|
||||||
@ -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 '<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 '</tr></table>';
|
||||||
print '</td><td>';
|
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);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
} else {
|
} else {
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
$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>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -392,10 +392,10 @@ class Propal extends CommonObject
|
|||||||
* @param string $origin 'order', ...
|
* @param string $origin 'order', ...
|
||||||
* @param int $origin_id Id of origin object
|
* @param int $origin_id Id of origin object
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*
|
* @param double $pu_ht_devise Unit price in currency
|
||||||
* @see add_product
|
* @see add_product
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_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;
|
global $mysoc, $conf, $langs;
|
||||||
|
|
||||||
@ -463,18 +463,22 @@ class Propal extends CommonObject
|
|||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
$pu_tva = $tabprice[4];
|
||||||
|
$pu_ttc = $tabprice[5];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Rang to use
|
// Rang to use
|
||||||
$rangtouse = $rang;
|
$rangtouse = $rang;
|
||||||
@ -537,7 +541,7 @@ class Propal extends CommonObject
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$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 int $date_end End date of the line
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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;
|
global $mysoc;
|
||||||
|
|
||||||
@ -647,17 +652,21 @@ class Propal extends CommonObject
|
|||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
$pu_tva = $tabprice[4];
|
||||||
|
$pu_ttc = $tabprice[5];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
|
||||||
$price = $pu;
|
$price = $pu;
|
||||||
@ -696,7 +705,7 @@ class Propal extends CommonObject
|
|||||||
$this->line->localtax1_type = $localtaxes_type[0];
|
$this->line->localtax1_type = $localtaxes_type[0];
|
||||||
$this->line->localtax2_type = $localtaxes_type[2];
|
$this->line->localtax2_type = $localtaxes_type[2];
|
||||||
$this->line->remise_percent = $remise_percent;
|
$this->line->remise_percent = $remise_percent;
|
||||||
$this->line->subprice = $pu;
|
$this->line->subprice = $pu_ht;
|
||||||
$this->line->info_bits = $info_bits;
|
$this->line->info_bits = $info_bits;
|
||||||
|
|
||||||
$this->line->vat_src_code = $vat_src_code;
|
$this->line->vat_src_code = $vat_src_code;
|
||||||
@ -725,7 +734,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency
|
// 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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
@ -1839,7 +1848,7 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function set_availability($user, $id, $notrigger=0)
|
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;
|
$error=0;
|
||||||
|
|
||||||
@ -1849,7 +1858,7 @@ class Propal extends CommonObject
|
|||||||
$sql.= " SET fk_availability = '".$id."'";
|
$sql.= " SET fk_availability = '".$id."'";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
@ -1861,6 +1870,7 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->oldcopy= clone $this;
|
$this->oldcopy= clone $this;
|
||||||
$this->fk_availability = $id;
|
$this->fk_availability = $id;
|
||||||
|
$this->availability_id = $availability_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $notrigger && empty($error))
|
if (! $notrigger && empty($error))
|
||||||
@ -1887,6 +1897,14 @@ class Propal extends CommonObject
|
|||||||
return -1*$error;
|
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)
|
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;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||||
$sql.= " SET fk_input_reason = '".$id."'";
|
$sql.= " SET fk_input_reason = ".$id;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
@ -1922,6 +1940,7 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->oldcopy= clone $this;
|
$this->oldcopy= clone $this;
|
||||||
$this->fk_input_reason = $id;
|
$this->fk_input_reason = $id;
|
||||||
|
$this->demand_reason_id = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1949,6 +1968,14 @@ class Propal extends CommonObject
|
|||||||
return -1*$error;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2733,6 +2760,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $availability_id Id of new delivery time
|
* @param int $availability_id Id of new delivery time
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
|
* @deprecated use set_availability
|
||||||
*/
|
*/
|
||||||
function availability($availability_id, $notrigger=0)
|
function availability($availability_id, $notrigger=0)
|
||||||
{
|
{
|
||||||
@ -2800,6 +2828,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $demand_reason_id Id of new source demand
|
* @param int $demand_reason_id Id of new source demand
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int >0 si ok, <0 si ko
|
* @return int >0 si ok, <0 si ko
|
||||||
|
* @deprecated use set_demand_reason
|
||||||
*/
|
*/
|
||||||
function demand_reason($demand_reason_id, $notrigger=0)
|
function demand_reason($demand_reason_id, $notrigger=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -111,13 +111,16 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if ($cancel)
|
if ($cancel)
|
||||||
{
|
{
|
||||||
if ($action != 'addlink')
|
if ($action != 'addlink' && $action != 'updateline')
|
||||||
{
|
{
|
||||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1);
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1);
|
||||||
header("Location: ".$urltogo);
|
header("Location: ".$urltogo);
|
||||||
exit;
|
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='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,6 +639,7 @@ if (empty($reshook))
|
|||||||
$predef='';
|
$predef='';
|
||||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||||
$price_ht = GETPOST('price_ht');
|
$price_ht = GETPOST('price_ht');
|
||||||
|
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||||
if (GETPOST('prod_entry_mode') == 'free')
|
if (GETPOST('prod_entry_mode') == 'free')
|
||||||
{
|
{
|
||||||
$idprod=0;
|
$idprod=0;
|
||||||
@ -670,7 +674,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||||
$error++;
|
$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');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -810,6 +814,7 @@ if (empty($reshook))
|
|||||||
$desc = $product_desc;
|
$desc = $product_desc;
|
||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
$fk_unit=GETPOST('units', 'alpha');
|
$fk_unit=GETPOST('units', 'alpha');
|
||||||
|
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
@ -831,7 +836,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_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) {
|
if ($result > 0) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
@ -902,6 +907,7 @@ if (empty($reshook))
|
|||||||
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
|
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
|
||||||
$pu_ht=GETPOST('price_ht');
|
$pu_ht=GETPOST('price_ht');
|
||||||
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
|
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
|
||||||
|
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
$info_bits = 0;
|
$info_bits = 0;
|
||||||
@ -962,7 +968,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $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 ($result >= 0) {
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
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 '<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 '</tr></table>';
|
||||||
print '</td><td>';
|
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);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
} else {
|
} else {
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
$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>';
|
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 $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param string $origin 'order', ...
|
* @param string $origin 'order', ...
|
||||||
* @param int $origin_id Id of origin object
|
* @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
|
* @return int >0 if OK, <0 if KO
|
||||||
*
|
*
|
||||||
* @see add_product
|
* @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)
|
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_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;
|
global $mysoc, $conf, $langs, $user;
|
||||||
|
|
||||||
@ -1310,18 +1311,20 @@ class Commande extends CommonOrder
|
|||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Rang to use
|
// Rang to use
|
||||||
$rangtouse = $rang;
|
$rangtouse = $rang;
|
||||||
@ -1385,7 +1388,7 @@ class Commande extends CommonOrder
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
@ -2745,17 +2748,17 @@ class Commande extends CommonOrder
|
|||||||
* Update a line in database
|
* Update a line in database
|
||||||
*
|
*
|
||||||
* @param int $rowid Id of line to update
|
* @param int $rowid Id of line to update
|
||||||
* @param string $desc Description de la ligne
|
* @param string $desc Description of line
|
||||||
* @param float $pu Prix unitaire
|
* @param float $pu Unit price
|
||||||
* @param float $qty Quantity
|
* @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 $txtva Taux TVA
|
||||||
* @param float $txlocaltax1 Local tax 1 rate
|
* @param float $txlocaltax1 Local tax 1 rate
|
||||||
* @param float $txlocaltax2 Local tax 2 rate
|
* @param float $txlocaltax2 Local tax 2 rate
|
||||||
* @param string $price_base_type HT or TTC
|
* @param string $price_base_type HT or TTC
|
||||||
* @param int $info_bits Miscellaneous informations on line
|
* @param int $info_bits Miscellaneous informations on line
|
||||||
* @param int $date_start Start date of the line
|
* @param int $date_start Start date of the line
|
||||||
* @param int $date_end End date of the line
|
* @param int $date_end End date of the line
|
||||||
* @param int $type Type of line (0=product, 1=service)
|
* @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 $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)
|
* @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 int $special_code Special code (also used by externals modules!)
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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;
|
global $conf, $mysoc, $langs, $user;
|
||||||
|
|
||||||
@ -2811,28 +2815,32 @@ class Commande extends CommonOrder
|
|||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
$pu_tva = $tabprice[4];
|
||||||
|
$pu_ttc = $tabprice[5];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Anciens indicateurs: $price, $subprice, $remise (a ne plus utiliser)
|
// Anciens indicateurs: $price, $subprice, $remise (a ne plus utiliser)
|
||||||
$price = $pu;
|
$price = $pu_ht;
|
||||||
if ($price_base_type == 'TTC')
|
if ($price_base_type == 'TTC')
|
||||||
{
|
{
|
||||||
$subprice = $tabprice[5];
|
$subprice = $pu_ttc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$subprice = $pu;
|
$subprice = $pu_ht;
|
||||||
}
|
}
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
if ($remise_percent > 0)
|
if ($remise_percent > 0)
|
||||||
@ -2910,7 +2918,7 @@ class Commande extends CommonOrder
|
|||||||
$this->line->pa_ht = $pa_ht;
|
$this->line->pa_ht = $pa_ht;
|
||||||
|
|
||||||
// Multicurrency
|
// 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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
|
|||||||
@ -142,10 +142,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$soc = new Societe($db);
|
|
||||||
$soc->fetch($object->socid);
|
|
||||||
|
|
||||||
|
|
||||||
$head = commande_prepare_head($object);
|
$head = commande_prepare_head($object);
|
||||||
dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order');
|
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->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);
|
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
@ -196,10 +192,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
$morehtmlref.='</div>';
|
$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_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -216,7 +208,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Contrat non trouve
|
// Contact not found
|
||||||
print "ErrorRecordNotFound";
|
print "ErrorRecordNotFound";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* 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 '<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 '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -832,7 +832,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
if (! empty($arrayfields['ba.ref']['checked']))
|
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"':''));
|
$form->select_comptes($account,'account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -850,7 +850,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
if (! empty($arrayfields['balance']['checked']))
|
if (! empty($arrayfields['balance']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
|
||||||
print $form->textwithpicto('', $htmltext, 1);
|
print $form->textwithpicto('', $htmltext, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -1931,7 +1931,7 @@ class AccountLine extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function info($id)
|
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.= ' b.fk_user_author, b.fk_user_rappro';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b';
|
||||||
$sql.= ' WHERE b.rowid = '.$id;
|
$sql.= ' WHERE b.rowid = '.$id;
|
||||||
@ -1958,6 +1958,7 @@ class AccountLine extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$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->date_rappro = $obj->daterappro; // Not yet managed
|
||||||
}
|
}
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* 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();
|
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
$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
|
// Lines of title fields
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
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="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
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)
|
if ($sall)
|
||||||
@ -404,7 +410,7 @@ if (! empty($arrayfields['b.clos']['checked']))
|
|||||||
// Balance
|
// Balance
|
||||||
if (! empty($arrayfields['balance']['checked']))
|
if (! empty($arrayfields['balance']['checked']))
|
||||||
{
|
{
|
||||||
print '<td></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="middle">';
|
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;
|
$var=true;
|
||||||
foreach ($accounts as $key=>$type)
|
foreach ($accounts as $key=>$type)
|
||||||
{
|
{
|
||||||
|
if ($i >= $limit) break;
|
||||||
|
|
||||||
$found++;
|
$found++;
|
||||||
|
|
||||||
$acc = new Account($db);
|
$acc = new Account($db);
|
||||||
@ -427,6 +435,15 @@ foreach ($accounts as $key=>$type)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
$solde = $acc->solde(1);
|
$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].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -486,7 +503,6 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
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>';
|
if (! $found) print '<tr '.$bc[$var].'><td colspan="'.$totalarray['nbfield'].'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||||
|
|
||||||
// Show total line
|
// 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">';
|
print '<tr class="liste_total">';
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -577,7 +593,7 @@ if (isset($totalarray['totalbalancefield']))
|
|||||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</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>';
|
else print '<td></td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -589,18 +605,6 @@ print "</div>";
|
|||||||
print "</form>";
|
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();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* 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>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="20%">'.$langs->trans("Ref")."</td>";
|
print '<tr><td class="titlefield">'.$langs->trans("Ref")."</td>";
|
||||||
print '<td colspan="4">';
|
print '<td>';
|
||||||
print $form->showrefnav($bankline, 'rowid', $linkback, 1, 'rowid', 'rowid');
|
print $form->showrefnav($bankline, 'rowid', $linkback, 1, 'rowid', 'rowid');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -285,7 +285,7 @@ if ($result)
|
|||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
print "<tr><td>".$langs->trans("Account")."</td>";
|
print "<tr><td>".$langs->trans("Account")."</td>";
|
||||||
print '<td colspan="4">';
|
print '<td>';
|
||||||
print $acct->getNomUrl(1,'transactions');
|
print $acct->getNomUrl(1,'transactions');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -294,7 +294,7 @@ if ($result)
|
|||||||
if (count($links))
|
if (count($links))
|
||||||
{
|
{
|
||||||
print "<tr><td>".$langs->trans("Links")."</td>";
|
print "<tr><td>".$langs->trans("Links")."</td>";
|
||||||
print '<td colspan="4">';
|
print '<td>';
|
||||||
foreach($links as $key=>$val)
|
foreach($links as $key=>$val)
|
||||||
{
|
{
|
||||||
if ($key) print '<br>';
|
if ($key) print '<br>';
|
||||||
@ -389,8 +389,6 @@ if ($result)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowspan=0;
|
|
||||||
|
|
||||||
//$user->rights->banque->modifier=false;
|
//$user->rights->banque->modifier=false;
|
||||||
//$user->rights->banque->consolidate=true;
|
//$user->rights->banque->consolidate=true;
|
||||||
|
|
||||||
@ -399,7 +397,7 @@ if ($result)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||||
{
|
{
|
||||||
print '<td colspan="3">';
|
print '<td>';
|
||||||
$form->select_types_paiements($objp->fk_type,"value",'',2);
|
$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).'">';
|
print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
|
||||||
if ($objp->receiptid)
|
if ($objp->receiptid)
|
||||||
@ -411,13 +409,10 @@ if ($result)
|
|||||||
|
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
$rowspan=7;
|
|
||||||
print '<td align="center" rowspan="'.$rowspan.'" width="20%"><input type="submit" class="button" value="'.$langs->trans("Update").'">';
|
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="4">'.$objp->fk_type.' '.$objp->num_chq.'</td>';
|
print '<td>'.$objp->fk_type.' '.$objp->num_chq.'</td>';
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -425,13 +420,13 @@ if ($result)
|
|||||||
print "<tr><td>".$langs->trans("Bank")."</td>";
|
print "<tr><td>".$langs->trans("Bank")."</td>";
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
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 '<input type="text" class="flat" size="40" name="banque" value="'.(empty($objp->banque) ? '' : $objp->banque).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="'.($rowspan?'3':'4').'">'.$objp->banque.'</td>';
|
print '<td>'.$objp->banque.'</td>';
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -439,13 +434,13 @@ if ($result)
|
|||||||
print "<tr><td>".$langs->trans("CheckTransmitter")."</td>";
|
print "<tr><td>".$langs->trans("CheckTransmitter")."</td>";
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
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 '<input type="text" class="flat" size="40" name="emetteur" value="'.(empty($objp->emetteur) ? '' : stripslashes($objp->emetteur)).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="'.($rowspan?'3':'4').'">'.$objp->emetteur.'</td>';
|
print '<td>'.$objp->emetteur.'</td>';
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
@ -453,13 +448,13 @@ if ($result)
|
|||||||
print '<tr><td>'.$langs->trans("DateOperation").'</td>';
|
print '<tr><td>'.$langs->trans("DateOperation").'</td>';
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
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 $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
print '<td>';
|
||||||
print dol_print_date($db->jdate($objp->do),"day");
|
print dol_print_date($db->jdate($objp->do),"day");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -469,7 +464,7 @@ if ($result)
|
|||||||
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
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);
|
print $form->select_date($db->jdate($objp->dv),'datev','','','','update',1,0,1,$objp->rappro);
|
||||||
if (! $objp->rappro)
|
if (! $objp->rappro)
|
||||||
{
|
{
|
||||||
@ -483,7 +478,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
print '<td>';
|
||||||
print dol_print_date($db->jdate($objp->dv),"day");
|
print dol_print_date($db->jdate($objp->dv),"day");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -493,7 +488,7 @@ if ($result)
|
|||||||
print "<tr><td>".$langs->trans("Label")."</td>";
|
print "<tr><td>".$langs->trans("Label")."</td>";
|
||||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
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="';
|
print '<input name="label" class="flat" '.($objp->rappro?' disabled':'').' value="';
|
||||||
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
||||||
{
|
{
|
||||||
@ -509,7 +504,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
print '<td>';
|
||||||
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
if (preg_match('/^\((.*)\)$/i',$objp->label,$reg))
|
||||||
{
|
{
|
||||||
// Label generique car entre parentheses. On l'affiche en le traduisant
|
// Label generique car entre parentheses. On l'affiche en le traduisant
|
||||||
@ -527,19 +522,22 @@ if ($result)
|
|||||||
print "<tr><td>".$langs->trans("Amount")."</td>";
|
print "<tr><td>".$langs->trans("Amount")."</td>";
|
||||||
if ($user->rights->banque->modifier)
|
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 '<input name="amount" class="flat" size="10" '.($objp->rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="'.($rowspan?'3':'4').'">';
|
print '<td>';
|
||||||
print price($objp->amount);
|
print price($objp->amount);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|
||||||
// Releve rappro
|
// Releve rappro
|
||||||
@ -554,10 +552,10 @@ if ($result)
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
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)
|
if ($user->rights->banque->consolidate)
|
||||||
{
|
{
|
||||||
print '<td colspan="3">';
|
print '<td>';
|
||||||
if ($objp->rappro)
|
if ($objp->rappro)
|
||||||
{
|
{
|
||||||
print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro?' disabled':'').'>';
|
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':'').'>';
|
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>';
|
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
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="4">'.$objp->num_releve.' </td>';
|
print '<td>'.$objp->num_releve.' </td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
|
print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
|
||||||
if ($user->rights->banque->consolidate)
|
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 '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"])?($_POST["reconciled"]?' checked="checked"':''):($objp->rappro?' checked="checked"':'')).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="4">'.yn($objp->rappro).'</td>';
|
print '<td>'.yn($objp->rappro).'</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
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
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
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)
|
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||||
@ -1314,6 +1314,7 @@ if (empty($reshook))
|
|||||||
$predef='';
|
$predef='';
|
||||||
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
|
||||||
$price_ht = GETPOST('price_ht');
|
$price_ht = GETPOST('price_ht');
|
||||||
|
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||||
if (GETPOST('prod_entry_mode') == 'free')
|
if (GETPOST('prod_entry_mode') == 'free')
|
||||||
{
|
{
|
||||||
$idprod=0;
|
$idprod=0;
|
||||||
@ -1348,7 +1349,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||||
$error ++;
|
$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');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -1505,6 +1506,7 @@ if (empty($reshook))
|
|||||||
$desc = $product_desc;
|
$desc = $product_desc;
|
||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
$fk_unit= GETPOST('units', 'alpha');
|
$fk_unit= GETPOST('units', 'alpha');
|
||||||
|
$pu_ht_devise = price2num($price_ht_devise, 'MU');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Margin
|
// Margin
|
||||||
@ -1524,7 +1526,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_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)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -1604,6 +1606,7 @@ if (empty($reshook))
|
|||||||
$pu_ht = GETPOST('price_ht');
|
$pu_ht = GETPOST('price_ht');
|
||||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||||
$qty = GETPOST('qty');
|
$qty = GETPOST('qty');
|
||||||
|
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
$info_bits = 0;
|
$info_bits = 0;
|
||||||
@ -1688,7 +1691,7 @@ if (empty($reshook))
|
|||||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'),
|
$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,
|
$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'),
|
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 ($result >= 0) {
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
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
|
$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="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
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 '<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 '</tr></table>';
|
||||||
print '</td><td>';
|
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);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
} else {
|
} else {
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
$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>';
|
print '</td></tr>';
|
||||||
//}
|
//}
|
||||||
@ -3419,7 +3430,8 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// List of payments
|
|
||||||
|
// List of previous situation invoices
|
||||||
|
|
||||||
$sign = 1;
|
$sign = 1;
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
|
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
|
||||||
@ -3530,9 +3542,11 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="noborder paymenttable" width="100%">';
|
|
||||||
|
|
||||||
// List of payments already done
|
// List of payments already done
|
||||||
|
|
||||||
|
print '<table class="noborder paymenttable" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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">' . ($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
|
||||||
print '<td class="liste_titre">' . $langs->trans('Date') . '</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 $situation_percent Situation advance percentage
|
||||||
* @param int $fk_prev_id Previous situation line id reference
|
* @param int $fk_prev_id Previous situation line id reference
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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
|
// Deprecation warning
|
||||||
if ($label) {
|
if ($label) {
|
||||||
@ -2493,7 +2494,7 @@ class Facture extends CommonInvoice
|
|||||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
// 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.
|
// 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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
@ -2506,6 +2507,7 @@ class Facture extends CommonInvoice
|
|||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Rank to use
|
// Rank to use
|
||||||
$rangtouse = $rang;
|
$rangtouse = $rang;
|
||||||
@ -2565,7 +2567,7 @@ class Facture extends CommonInvoice
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
@ -2628,9 +2630,10 @@ class Facture extends CommonInvoice
|
|||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param int $situation_percent Situation advance percentage
|
* @param int $situation_percent Situation advance percentage
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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;
|
global $conf,$user;
|
||||||
// Deprecation warning
|
// Deprecation warning
|
||||||
@ -2688,7 +2691,7 @@ class Facture extends CommonInvoice
|
|||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
@ -2703,6 +2706,7 @@ class Facture extends CommonInvoice
|
|||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Old properties: $price, $remise (deprecated)
|
// Old properties: $price, $remise (deprecated)
|
||||||
$price = $pu;
|
$price = $pu;
|
||||||
@ -2778,7 +2782,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->line->pa_ht = $pa_ht;
|
$this->line->pa_ht = $pa_ht;
|
||||||
|
|
||||||
// Multicurrency
|
// 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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
|
|||||||
@ -138,44 +138,58 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$head = facture_prepare_head($object);
|
$head = facture_prepare_head($object);
|
||||||
|
|
||||||
|
$totalpaye = $object->getSommePaiement();
|
||||||
|
|
||||||
dol_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
dol_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
||||||
|
|
||||||
/*
|
// Invoice content
|
||||||
* 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>';
|
$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>';
|
|
||||||
|
|
||||||
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
print '<tr><td >';
|
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||||
print $langs->trans('RefCustomer');
|
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||||
print '</td>';
|
// Thirdparty
|
||||||
print '<td colspan="3">';
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||||
print $object->ref_client;
|
// Project
|
||||||
print '</td></tr>';
|
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>';
|
||||||
|
|
||||||
// Customer
|
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
|
||||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'compta').'</td></tr>';
|
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
@ -99,6 +99,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$head = facture_prepare_head($object);
|
$head = facture_prepare_head($object);
|
||||||
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), 0, 'bill');
|
||||||
|
|
||||||
|
$totalpaye = $object->getSommePaiement();
|
||||||
|
|
||||||
// Construit liste des fichiers
|
// Construit liste des fichiers
|
||||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||||
@ -109,50 +110,73 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
|
|
||||||
// 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>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
$modulepart = 'facture';
|
$modulepart = 'facture';
|
||||||
$permission = $user->rights->facture->creer;
|
$permission = $user->rights->facture->creer;
|
||||||
$permtoedit = $user->rights->facture->creer;
|
$permtoedit = $user->rights->facture->creer;
|
||||||
$param = '&id=' . $object->id;
|
$param = '&id=' . $object->id;
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -983,8 +983,8 @@ if ($action == 'create')
|
|||||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
|
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
|
||||||
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
|
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, $forceaddid=0, $morecss='');
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'')).'">' . $langs->trans("AddProject") . '</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
|
$id = GETPOST("facid","int");
|
||||||
|
$ref=GETPOST("ref",'alpha');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -40,22 +43,78 @@ $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info');
|
|||||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||||
llxHeader('', $title, $helpurl);
|
llxHeader('', $title, $helpurl);
|
||||||
|
|
||||||
$fac = new Facture($db);
|
$object = new Facture($db);
|
||||||
$fac->fetch($_GET["facid"]);
|
$object->fetch($id, $ref);
|
||||||
$fac->info($_GET["facid"]);
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$object->info($object->id);
|
||||||
$soc->fetch($fac->socid);
|
|
||||||
|
|
||||||
$head = facture_prepare_head($fac);
|
$head = facture_prepare_head($object);
|
||||||
dol_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
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>';
|
print '<table width="100%"><tr><td>';
|
||||||
dol_print_object_info($fac);
|
dol_print_object_info($object);
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -71,51 +71,69 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
$object->fetch($id,$ref);
|
$object->fetch($id,$ref);
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$object->fetch_thirdparty();
|
||||||
$soc->fetch($object->socid);
|
|
||||||
|
|
||||||
$head = facture_prepare_head($object);
|
$head = facture_prepare_head($object);
|
||||||
|
|
||||||
|
$totalpaye = $object->getSommePaiement();
|
||||||
|
|
||||||
dol_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), 0, 'bill');
|
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
|
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||||
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
|
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans('RefCustomer');
|
|
||||||
print '</td>';
|
|
||||||
print '<td colspan="3">';
|
|
||||||
print $object->ref_client;
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Company
|
print '<div class="fichecenter">';
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<br>';
|
$cssclass="titlefield";
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,48 +149,63 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill');
|
dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'),0,'bill');
|
||||||
|
|
||||||
/*
|
// Invoice content
|
||||||
* Facture
|
|
||||||
*/
|
$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%">';
|
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
|
// 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();
|
print $object->getLibType();
|
||||||
if ($object->type == Facture::TYPE_REPLACEMENT)
|
if ($object->type == Facture::TYPE_REPLACEMENT)
|
||||||
{
|
{
|
||||||
@ -407,50 +422,101 @@ if ($object->id > 0)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
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 '<tr><td>'.$langs->trans("RIB").'</td><td colspan="3">';
|
||||||
print $object->thirdparty->display_rib();
|
print $object->thirdparty->display_rib();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
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();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if (empty($reshook))
|
|||||||
if (! empty($multicurrency_amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
if (! empty($multicurrency_amounts[$cursorfacid])) $atleastonepaymentnotnull++;
|
||||||
$result=$tmpinvoice->fetch($cursorfacid);
|
$result=$tmpinvoice->fetch($cursorfacid);
|
||||||
if ($result <= 0) dol_print_error($db);
|
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])
|
if ($multicurrency_amounts[$cursorfacid])
|
||||||
{
|
{
|
||||||
// Check amount
|
// Check amount
|
||||||
|
|||||||
@ -94,9 +94,9 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid";
|
|||||||
$sql.= " AND bc.entity = ".$conf->entity;
|
$sql.= " AND bc.entity = ".$conf->entity;
|
||||||
|
|
||||||
// Search criteria
|
// 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_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 ($month > 0)
|
||||||
{
|
{
|
||||||
if ($year > 0 && empty($day))
|
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.'">';
|
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td class="liste_titre">';
|
||||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
print '<input class="flat maxwidth50" type="text" name="search_amount" value="'.$search_amount.'">';
|
print '<input class="flat maxwidth50" type="text" name="search_amount" value="'.$search_amount.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
|
|||||||
@ -248,30 +248,30 @@ if ($resql)
|
|||||||
|
|
||||||
// Lines for filters fields
|
// Lines for filters fields
|
||||||
print '<tr class="liste_titre">';
|
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 '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
|
||||||
print '</td>';
|
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.'">';
|
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.'">';
|
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||||
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
$formother->select_year($year?$year:-1,'year',1, 20, 5);
|
||||||
print '</td>';
|
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 '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td class="liste_titre">';
|
||||||
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
|
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
|
||||||
print '</td>';
|
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 '<input class="flat" type="text" size="4" name="search_payment_num" value="'.$search_payment_num.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td class="liste_titre">';
|
||||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
print '</td>';
|
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 '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
@ -280,7 +280,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -118,7 +118,7 @@ if ($result)
|
|||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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("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("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
|
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
|
||||||
@ -130,10 +130,10 @@ if ($result)
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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_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 class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="6"></td>';
|
||||||
print '<td> </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="12"></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="8"></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"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
|
|||||||
@ -185,7 +185,7 @@ if ($result)
|
|||||||
// Account
|
// Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td class="liste_titre">';
|
||||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -196,6 +196,7 @@ if ($result)
|
|||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
|
|||||||
@ -446,7 +446,7 @@ if ($id > 0)
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Type
|
// 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>";
|
print "</tr>";
|
||||||
|
|
||||||
// Period end date
|
// Period end date
|
||||||
|
|||||||
@ -153,6 +153,8 @@ class ChargeSociales extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
// Nettoyage parametres
|
// Nettoyage parametres
|
||||||
$newamount=price2num($this->amount,'MT');
|
$newamount=price2num($this->amount,'MT');
|
||||||
|
|
||||||
@ -162,17 +164,18 @@ class ChargeSociales extends CommonObject
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$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.= " VALUES (".$this->type;
|
||||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||||
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL");
|
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL");
|
||||||
$sql.= ", '".$this->db->escape($this->lib)."',";
|
$sql.= ", '".$this->db->escape($this->lib)."'";
|
||||||
$sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',";
|
$sql.= ", '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."'";
|
||||||
$sql.= " '".price2num($newamount)."',";
|
$sql.= ", '".price2num($newamount)."'";
|
||||||
$sql.= " ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
|
$sql.= ", ".$user->id;
|
||||||
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
@ -276,10 +279,11 @@ class ChargeSociales extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||||
$sql.= " SET libelle='".$this->db->escape($this->lib)."',";
|
$sql.= " SET libelle='".$this->db->escape($this->lib)."'";
|
||||||
$sql.= " date_ech='".$this->db->idate($this->date_ech)."',";
|
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
|
||||||
$sql.= " periode='".$this->db->idate($this->periode)."',";
|
$sql.= ", periode='".$this->db->idate($this->periode)."'";
|
||||||
$sql.= " amount='".price2num($this->amount,'MT')."'";
|
$sql.= ", amount='".price2num($this->amount,'MT')."'";
|
||||||
|
$sql.= ", fk_user_modif=".$user->id;
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
@ -505,8 +509,9 @@ class ChargeSociales extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function info($id)
|
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 = "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.= " fk_user_author, fk_user_modif, fk_user_valid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
|
||||||
$sql.= " WHERE e.rowid = ".$id;
|
$sql.= " WHERE e.rowid = ".$id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||||
@ -522,7 +527,13 @@ class ChargeSociales extends CommonObject
|
|||||||
if ($obj->fk_user_author) {
|
if ($obj->fk_user_author) {
|
||||||
$cuser = new User($this->db);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch($obj->fk_user_author);
|
$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) {
|
if ($obj->fk_user_valid) {
|
||||||
@ -532,7 +543,7 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$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->date_validation = $this->db->jdate($obj->datev);
|
||||||
$this->import_key = $obj->import_key;
|
$this->import_key = $obj->import_key;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.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.'/compta/bank/class/account.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php';
|
||||||
|
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("banks");
|
$langs->load("banks");
|
||||||
@ -38,7 +39,7 @@ $refund=GETPOST("refund","int");
|
|||||||
if (empty($refund)) $refund=0;
|
if (empty($refund)) $refund=0;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||||
|
|
||||||
@ -179,8 +180,9 @@ if ($action == 'delete')
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
$title=$langs->trans("VAT") . " - " . $langs->trans("Card");
|
||||||
llxHeader();
|
$help_url='';
|
||||||
|
llxHeader("",$title,$helpurl);
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
@ -242,7 +244,7 @@ if ($action == 'create')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr>";
|
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 $form->select_date($datep,"datep",'','','','add',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -263,7 +265,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
if (! empty($conf->banque->enabled))
|
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
|
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -296,20 +298,10 @@ if ($action == 'create')
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// View mode
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* Barre d'action */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$h = 0;
|
$head=vat_prepare_head($object);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id;
|
|
||||||
$head[$h][1] = $langs->trans('Card');
|
|
||||||
$head[$h][2] = 'card';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
|
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
|
||||||
|
|
||||||
@ -317,7 +309,7 @@ if ($id)
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr>";
|
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 $object->ref;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -325,19 +317,19 @@ if ($id)
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||||
|
|
||||||
print "<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 dol_print_date($object->datep,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $form->editfieldkey("DateValue", 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
|
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 $form->editfieldval("DateValue", 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
|
||||||
//print dol_print_date($object->datev,'day');
|
//print dol_print_date($object->datev,'day');
|
||||||
print '</td></tr>';
|
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))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
@ -348,7 +340,7 @@ if ($id)
|
|||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td>';
|
||||||
print $bankline->getNomUrl(1,0,'showall');
|
print $bankline->getNomUrl(1,0,'showall');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -356,14 +348,12 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"');
|
$reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action buttons
|
* Action buttons
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -671,4 +671,52 @@ class Tva extends CommonObject
|
|||||||
return $result;
|
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
|
// Account
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td class="liste_titre">';
|
||||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -991,6 +991,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -1381,7 +1382,6 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 3;
|
$cols = 3;
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
@ -1395,7 +1395,7 @@ else
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo '<br>';
|
echo '<br>';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||||
{
|
{
|
||||||
@ -1990,8 +1990,8 @@ else
|
|||||||
|
|
||||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||||
{
|
{
|
||||||
$langs->load("bills");
|
$langs->load("orders");
|
||||||
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>';
|
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>';
|
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);
|
$object = new Contrat($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
// Add new contact
|
||||||
* Ajout d'un nouveau contact
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'addcontact' && $user->rights->contrat->creer)
|
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)
|
if ($action == 'deletecontact' && $user->rights->contrat->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -134,37 +132,100 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
dol_fiche_head($head, $hselected, $langs->trans("Contract"), 0, 'contract');
|
dol_fiche_head($head, $hselected, $langs->trans("Contract"), 0, 'contract');
|
||||||
|
|
||||||
/*
|
// Contract card
|
||||||
* Contrat
|
|
||||||
*/
|
$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%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
// Reference du contrat
|
// Ligne info remises tiers
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
print '<tr><td class="titlefield">'.$langs->trans('Discount').'</td><td colspan="3">';
|
||||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
||||||
print "</td></tr>";
|
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>';
|
||||||
|
|
||||||
// Customer
|
// Date
|
||||||
print "<tr><td>".$langs->trans("Customer")."</td>";
|
print '<tr>';
|
||||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
print '<td class="titlefield">';
|
||||||
|
print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,0);
|
||||||
// Ligne info remises tiers
|
print '</td><td>';
|
||||||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,0,'datehourpicker');
|
||||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
print '</td>';
|
||||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
print '</tr>';
|
||||||
$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>';
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Contacts lines
|
// 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%">';
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
$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>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
$modulepart = 'contract';
|
$modulepart = 'contract';
|
||||||
$permission = $user->rights->contrat->creer;
|
$permission = $user->rights->contrat->creer;
|
||||||
$permtoedit = $user->rights->contrat->creer;
|
$permtoedit = $user->rights->contrat->creer;
|
||||||
|
|||||||
@ -40,20 +40,91 @@ $result = restrictedArea($user, 'contrat',$contratid,'');
|
|||||||
|
|
||||||
llxHeader('',$langs->trans("Contract"),"");
|
llxHeader('',$langs->trans("Contract"),"");
|
||||||
|
|
||||||
$contrat = new Contrat($db);
|
$object = new Contrat($db);
|
||||||
$contrat->fetch($contratid);
|
$object->fetch($contratid);
|
||||||
$contrat->info($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');
|
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>';
|
print '<table width="100%"><tr><td>';
|
||||||
dol_print_object_info($contrat);
|
dol_print_object_info($object);
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -488,7 +488,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
if (! empty($arrayfields['sale_representative']['checked']))
|
if (! empty($arrayfields['sale_representative']['checked']))
|
||||||
{
|
{
|
||||||
print '<td></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['c.date_contrat']['checked']))
|
if (! empty($arrayfields['c.date_contrat']['checked']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -72,31 +72,98 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
dol_fiche_head($head, 'note', $langs->trans("Contract"), 0, 'contract');
|
dol_fiche_head($head, 'note', $langs->trans("Contract"), 0, 'contract');
|
||||||
|
|
||||||
|
// Contract card
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$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
|
$morehtmlref='';
|
||||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
//if (! empty($modCodeContract->code_auto)) {
|
||||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
$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
|
$morehtmlref.='<div class="refidno">';
|
||||||
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
// Ref customer
|
||||||
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
|
||||||
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1);
|
||||||
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
// Ref supplier
|
||||||
print '. ';
|
$morehtmlref.='<br>';
|
||||||
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
|
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||||
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||||
print '.';
|
// Thirdparty
|
||||||
print '</td></tr>';
|
$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 "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if (! dol_is_dir($upload_dir))
|
|||||||
exit;*/
|
exit;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<!-- TYPE='.$type.' -->'."\n";
|
print '<!-- ajaxdirpreview type='.$type.' -->'."\n";
|
||||||
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' type='.$type.' module='.$module.' url='.$url.' '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
print '<!-- Page called with mode='.(isset($mode)?$mode:'').' type='.$type.' module='.$module.' url='.$url.' '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
|
|
||||||
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||||
|
|||||||
@ -103,6 +103,7 @@ class box_comptes extends ModeleBoxes
|
|||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$account_static->id = $objp->rowid;
|
$account_static->id = $objp->rowid;
|
||||||
|
$account_static->ref = $objp->ref;
|
||||||
$account_static->label = $objp->label;
|
$account_static->label = $objp->label;
|
||||||
$account_static->number = $objp->number;
|
$account_static->number = $objp->number;
|
||||||
$solde=$account_static->solde(0);
|
$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.'_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_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_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
|
||||||
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 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_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
|
||||||
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
|
||||||
$array_key.'_total_ht'=>price2num($object->total_ht),
|
$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_localtax1'=>price2num($object->total_localtax1),
|
||||||
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
|
||||||
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
$array_key.'_total_ttc'=>price2num($object->total_ttc),
|
||||||
|
|||||||
@ -1491,9 +1491,10 @@ abstract class CommonObject
|
|||||||
* Change the multicurrency rate
|
* Change the multicurrency rate
|
||||||
*
|
*
|
||||||
* @param double $rate 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
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function setMulticurrencyRate($rate)
|
function setMulticurrencyRate($rate, $mode=1)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')');
|
dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')');
|
||||||
if ($this->statut >= 0 || $this->element == 'societe')
|
if ($this->statut >= 0 || $this->element == 'societe')
|
||||||
@ -1513,21 +1514,28 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
foreach ($this->lines as &$line)
|
foreach ($this->lines as &$line)
|
||||||
{
|
{
|
||||||
|
if($mode == 1) {
|
||||||
|
$line->subprice = 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($this->element) {
|
switch ($this->element) {
|
||||||
case 'propal':
|
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;
|
break;
|
||||||
case 'commande':
|
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;
|
break;
|
||||||
case 'facture':
|
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;
|
break;
|
||||||
case 'supplier_proposal':
|
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;
|
break;
|
||||||
case 'order_supplier':
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
dol_syslog(get_class($this).'::setMulticurrencyRate no updateline defined', LOG_DEBUG);
|
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>';
|
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
||||||
|
|
||||||
// Multicurrency
|
// 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>';
|
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>';
|
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
|
||||||
|
|
||||||
// Multicurrency
|
// 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>';
|
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 '<form method="POST" action="'.$page.'">';
|
||||||
print '<input type="hidden" name="action" value="setmulticurrencyrate">';
|
print '<input type="hidden" name="action" value="setmulticurrencyrate">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
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 '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
@ -4231,6 +4235,10 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
$out.= '</select>';
|
$out.= '</select>';
|
||||||
|
// Make select dynamic
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
|
$out.= ajax_combobox($htmlname);
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5188,7 +5196,7 @@ class Form
|
|||||||
</a>
|
</a>
|
||||||
<input type="hidden" class="'.$htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
|
<input type="hidden" class="'.$htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd class="dropowndd">
|
||||||
<div class="multiselectcheckbox'.$htmlname.'">
|
<div class="multiselectcheckbox'.$htmlname.'">
|
||||||
<ul class="ul'.$htmlname.'">
|
<ul class="ul'.$htmlname.'">
|
||||||
'.$lis.'
|
'.$lis.'
|
||||||
@ -5997,9 +6005,10 @@ class Form
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
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_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.='<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 ($addcheckuncheckall)
|
||||||
{
|
{
|
||||||
if (! empty($conf->use_javascript_ajax)) $out.='<input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions">';
|
if (! empty($conf->use_javascript_ajax)) $out.='<input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions">';
|
||||||
|
|||||||
@ -838,9 +838,8 @@ class FormFile
|
|||||||
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
if (preg_match('/text/',$mime)) $tmpout.= ' target="_blank"';
|
||||||
$tmpout.= '>';
|
$tmpout.= '>';
|
||||||
$tmpout.=img_mime($relativepath, $file["name"]).' ';
|
$tmpout.=img_mime($relativepath, $file["name"]).' ';
|
||||||
$tmpout.= $langs->trans("Download ".$ext);
|
$tmpout.= $langs->trans("Download").' '.$ext;
|
||||||
$tmpout.= '</a></li>'."\n";
|
$tmpout.= '</a></li>'."\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
$out.=$tmpout;
|
$out.=$tmpout;
|
||||||
$out.='</ul></div></dd>
|
$out.='</ul></div></dd>
|
||||||
@ -933,7 +932,7 @@ class FormFile
|
|||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||||
}
|
}
|
||||||
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">'."\n";
|
print '<table width="100%" class="'.($useinecm?'liste noborderbottom':'liste').'">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
||||||
@ -1088,7 +1087,7 @@ class FormFile
|
|||||||
}
|
}
|
||||||
if ($nboffiles == 0)
|
if ($nboffiles == 0)
|
||||||
{
|
{
|
||||||
print '<tr '.$bc[false].'><td colspan="'.(empty($useinecm)?'5':'4').'" class="opacitymedium">';
|
print '<tr '.$bc[false].'><td colspan="'.(empty($useinecm)?'5':'5').'" class="opacitymedium">';
|
||||||
if (empty($textifempty)) print $langs->trans("NoFileFound");
|
if (empty($textifempty)) print $langs->trans("NoFileFound");
|
||||||
else print $textifempty;
|
else print $textifempty;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -1131,7 +1130,7 @@ class FormFile
|
|||||||
// Show list of documents
|
// Show list of documents
|
||||||
if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles"));
|
if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles"));
|
||||||
if (empty($url)) $url=$_SERVER["PHP_SELF"];
|
if (empty($url)) $url=$_SERVER["PHP_SELF"];
|
||||||
print '<table width="100%" class="nobordernopadding">'."\n";
|
print '<table width="100%" class="noborder">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
$sortref="fullname";
|
$sortref="fullname";
|
||||||
if ($modulepart == 'invoice_supplier') $sortref='level1name';
|
if ($modulepart == 'invoice_supplier') $sortref='level1name';
|
||||||
|
|||||||
@ -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;
|
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
if ($obj->type!='separate') {
|
||||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||||
$this->export_entities_array[$r][$fieldname]=$keyforelement;
|
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||||
|
$this->export_entities_array[$r][$fieldname]=$keyforelement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add axtra fields
|
// End add axtra fields
|
||||||
|
|||||||
@ -135,6 +135,8 @@ function societe_prepare_head(Societe $object)
|
|||||||
// Bank accounrs
|
// Bank accounrs
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
|
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
|
||||||
{
|
{
|
||||||
|
$langs->load("banks");
|
||||||
|
|
||||||
$nbBankAccount=0;
|
$nbBankAccount=0;
|
||||||
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("BankAccounts");
|
$head[$h][1] = $langs->trans("BankAccounts");
|
||||||
|
|||||||
@ -45,16 +45,16 @@ function emailing_prepare_head(Mailing $object)
|
|||||||
$head[$h][1] = $langs->trans("MailRecipients");
|
$head[$h][1] = $langs->trans("MailRecipients");
|
||||||
if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
|
if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
|
||||||
$head[$h][2] = 'targets';
|
$head[$h][2] = 'targets';
|
||||||
|
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
}
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
||||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
{
|
||||||
$head[$h][2] = 'advtargets';
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||||
$h++;
|
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||||
}
|
$head[$h][2] = 'advtargets';
|
||||||
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
$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
|
// Tab to link resources
|
||||||
if ($conf->resource->enabled)
|
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");
|
$head[$h][1] = $langs->trans("Resources");
|
||||||
|
if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
|
||||||
$head[$h][2] = 'resource';
|
$head[$h][2] = 'resource';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
@ -1741,7 +1741,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrapping pour les produits et services
|
// 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))
|
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 ': ';
|
else print ': ';
|
||||||
if (is_object($object->user_creation))
|
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 print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
@ -264,14 +264,14 @@ function dol_print_object_info($object, $usetable=0)
|
|||||||
else print ': ';
|
else print ': ';
|
||||||
if (is_object($object->user_modification))
|
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 print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
@ -300,14 +300,14 @@ function dol_print_object_info($object, $usetable=0)
|
|||||||
else print ': ';
|
else print ': ';
|
||||||
if (is_object($object->user_validation))
|
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 print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
@ -336,14 +336,14 @@ function dol_print_object_info($object, $usetable=0)
|
|||||||
else print ': ';
|
else print ': ';
|
||||||
if (is_object($object->user_approve))
|
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 print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
@ -372,7 +372,7 @@ function dol_print_object_info($object, $usetable=0)
|
|||||||
else print ': ';
|
else print ': ';
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_approve_id2);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
else print '<br>';
|
else print '<br>';
|
||||||
@ -400,14 +400,14 @@ function dol_print_object_info($object, $usetable=0)
|
|||||||
else print ': ';
|
else print ': ';
|
||||||
if (is_object($object->user_cloture))
|
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 print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_cloture);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
@ -436,14 +436,14 @@ function dol_print_object_info($object, $usetable=0)
|
|||||||
else print ': ';
|
else print ': ';
|
||||||
if (is_object($object->user_rappro))
|
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 print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
$userstatic->fetch($object->user_rappro);
|
$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");
|
else print $langs->trans("Unknown");
|
||||||
}
|
}
|
||||||
if ($usetable) print '</td></tr>';
|
if ($usetable) print '</td></tr>';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -41,16 +41,6 @@ function loan_prepare_head($object)
|
|||||||
$head[$tab][2] = 'card';
|
$head[$tab][2] = 'card';
|
||||||
$tab++;
|
$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
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// 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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
@ -68,6 +58,16 @@ function loan_prepare_head($object)
|
|||||||
$head[$tab][2] = 'documents';
|
$head[$tab][2] = 'documents';
|
||||||
$tab++;
|
$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][0] = DOL_URL_ROOT.'/loan/info.php?id='.$object->id;
|
||||||
$head[$tab][1] = $langs->trans("Info");
|
$head[$tab][1] = $langs->trans("Info");
|
||||||
$head[$tab][2] = '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 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 integer $progress Situation invoices progress (value from 0 to 100, 100 by default)
|
||||||
* @param double $multicurrency_tx Currency rate (1 by default)
|
* @param double $multicurrency_tx Currency rate (1 by default)
|
||||||
|
* @param double $pu_ht_devise Amount in currency
|
||||||
* @return array [
|
* @return array [
|
||||||
* 0=total_ht,
|
* 0=total_ht,
|
||||||
* 1=total_vat, (main vat only)
|
* 1=total_vat, (main vat only)
|
||||||
@ -70,8 +71,9 @@
|
|||||||
* 16=multicurrency_total_ht
|
* 16=multicurrency_total_ht
|
||||||
* 17=multicurrency_total_tva
|
* 17=multicurrency_total_tva
|
||||||
* 18=multicurrency_total_ttc
|
* 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;
|
global $conf,$mysoc,$db;
|
||||||
|
|
||||||
@ -140,6 +142,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
|||||||
}
|
}
|
||||||
else dol_print_error($db);
|
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)
|
// initialize total (may be HT or TTC depending on price_base_type)
|
||||||
$tot_sans_remise = $pu * $qty * $progress / 100;
|
$tot_sans_remise = $pu * $qty * $progress / 100;
|
||||||
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 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[16] = price2num($result[0] * $multicurrency_tx, 'MT');
|
||||||
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
|
$result[17] = price2num($result[1] * $multicurrency_tx, 'MT');
|
||||||
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
|
$result[18] = price2num($result[2] * $multicurrency_tx, 'MT');
|
||||||
|
$result[19] = price2num($pu_ht_devise, 'MU');
|
||||||
|
|
||||||
// initialize result array
|
// initialize result array
|
||||||
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
|
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
|
||||||
|
|||||||
@ -35,7 +35,7 @@ function stock_prepare_head($object)
|
|||||||
$head = array();
|
$head = array();
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/product/stock/card.php?id='.$object->id;
|
$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';
|
$head[$h][2] = 'card';
|
||||||
$h++;
|
$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;
|
||||||
|
}
|
||||||
@ -55,6 +55,9 @@ class ImportCsv extends ModeleImports
|
|||||||
var $cacheconvert=array(); // Array to cache list of value found after a convertion
|
var $cacheconvert=array(); // Array to cache list of value found after a convertion
|
||||||
var $cachefieldtable=array(); // Array to cache list of value found into fields@tables
|
var $cachefieldtable=array(); // Array to cache list of value found into fields@tables
|
||||||
|
|
||||||
|
var $nbinsert = 0; // # of insert done during the import
|
||||||
|
var $nbupdate = 0; // # of update done during the import
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -266,9 +269,10 @@ class ImportCsv extends ModeleImports
|
|||||||
* @param Object $objimport Object import (contains objimport->array_import_tables, objimport->array_import_fields, objimport->array_import_convertvalue, ...)
|
* @param Object $objimport Object import (contains objimport->array_import_tables, objimport->array_import_fields, objimport->array_import_convertvalue, ...)
|
||||||
* @param int $maxfields Max number of fields to use
|
* @param int $maxfields Max number of fields to use
|
||||||
* @param string $importid Import key
|
* @param string $importid Import key
|
||||||
|
* @param array $updatekeys Array of keys to use to try to do update
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid)
|
function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid,$updatekeys)
|
||||||
{
|
{
|
||||||
global $langs,$conf,$user;
|
global $langs,$conf,$user;
|
||||||
global $thirdparty_static; // Specific to thirdparty import
|
global $thirdparty_static; // Specific to thirdparty import
|
||||||
@ -299,13 +303,15 @@ class ImportCsv extends ModeleImports
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$last_insert_id_array = array(); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id (eg: extrafields fk_object will be set with the last inserted object's id)
|
$last_insert_id_array = array(); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id (eg: extrafields fk_object will be set with the last inserted object's id)
|
||||||
|
$updatedone = false;
|
||||||
|
$insertdone = false;
|
||||||
// For each table to insert, me make a separate insert
|
// For each table to insert, me make a separate insert
|
||||||
foreach($objimport->array_import_tables[0] as $alias => $tablename)
|
foreach($objimport->array_import_tables[0] as $alias => $tablename)
|
||||||
{
|
{
|
||||||
// Build sql request
|
// Build sql request
|
||||||
$sql='';
|
$sql='';
|
||||||
$listfields='';
|
$listfields=array();
|
||||||
$listvalues='';
|
$listvalues=array();
|
||||||
$i=0;
|
$i=0;
|
||||||
$errorforthistable=0;
|
$errorforthistable=0;
|
||||||
|
|
||||||
@ -539,36 +545,35 @@ class ImportCsv extends ModeleImports
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define $listfields and $listvalues to build SQL request
|
// Define $listfields and $listvalues to build SQL request
|
||||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
$listfields[] = $fieldname;
|
||||||
$listfields.=$fieldname;
|
|
||||||
|
|
||||||
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
|
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
|
||||||
if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues.=($newval=='0'?$newval:"null");
|
if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues[] = ($newval=='0'?$newval:"null");
|
||||||
elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues.="''";
|
elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues[] = "''";
|
||||||
else $listvalues.="'".$this->db->escape($newval)."'";
|
else $listvalues[] = "'".$this->db->escape($newval)."'";
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We add hidden fields (but only if there is at least one field to add into table)
|
// We add hidden fields (but only if there is at least one field to add into table)
|
||||||
if ($listfields && is_array($objimport->array_import_fieldshidden[0]))
|
if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0]))
|
||||||
{
|
{
|
||||||
// Loop on each hidden fields to add them into listfields/listvalues
|
// Loop on each hidden fields to add them into listfields/listvalues
|
||||||
foreach($objimport->array_import_fieldshidden[0] as $key => $val)
|
foreach($objimport->array_import_fieldshidden[0] as $key => $val)
|
||||||
{
|
{
|
||||||
if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
|
if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table
|
||||||
if ($listfields) { $listfields.=', '; $listvalues.=', '; }
|
|
||||||
if ($val == 'user->id')
|
if ($val == 'user->id')
|
||||||
{
|
{
|
||||||
$listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
$listfields[] = preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||||
$listvalues.=$user->id;
|
$listvalues[] = $user->id;
|
||||||
}
|
}
|
||||||
elseif (preg_match('/^lastrowid-/',$val))
|
elseif (preg_match('/^lastrowid-/',$val))
|
||||||
{
|
{
|
||||||
$tmp=explode('-',$val);
|
$tmp=explode('-',$val);
|
||||||
$lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0;
|
$lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0;
|
||||||
$listfields.=preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
$keyfield = preg_replace('/^'.preg_quote($alias).'\./','',$key);
|
||||||
$listvalues.=$lastinsertid;
|
$listfields[] = $keyfield;
|
||||||
|
$listvalues[] = $lastinsertid;
|
||||||
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
|
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -578,47 +583,114 @@ class ImportCsv extends ModeleImports
|
|||||||
// If no error for this $alias/$tablename, we have a complete $listfields and $listvalues that are defined
|
// If no error for this $alias/$tablename, we have a complete $listfields and $listvalues that are defined
|
||||||
if (! $errorforthistable)
|
if (! $errorforthistable)
|
||||||
{
|
{
|
||||||
//print "$alias/$tablename/$listfields/$listvalues<br>";
|
//print "$alias/$tablename/$listfields/$listvalues<br>";
|
||||||
if ($listfields)
|
if (!empty($listfields))
|
||||||
{
|
{
|
||||||
//var_dump($objimport->array_import_convertvalue); exit;
|
$updatedone = false;
|
||||||
|
$insertdone = false;
|
||||||
|
if(!empty($updatekeys)) {
|
||||||
|
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||||
|
if(empty($lastinsertid)) {
|
||||||
|
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||||
|
|
||||||
// Build SQL request
|
$data = array_combine($listfields, $listvalues);
|
||||||
if (empty($tablewithentity_cache[$tablename]))
|
$where = array();
|
||||||
{
|
$filters = array();
|
||||||
$sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key';
|
foreach ($updatekeys as $key) {
|
||||||
if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias];
|
$col = $objimport->array_import_updatekeys[0][$key];
|
||||||
$sql.=') VALUES('.$listvalues.", '".$importid."'";
|
$key=preg_replace('/^.*\./i','',$key);
|
||||||
}
|
$where[] = $key.' = '.$data[$key];
|
||||||
else
|
$filters[] = $col.' = '.$data[$key];
|
||||||
{
|
}
|
||||||
$sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key, entity';
|
$sqlSelect.= ' WHERE '.implode(' AND ', $where);
|
||||||
if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias];
|
|
||||||
$sql.=') VALUES('.$listvalues.", '".$importid."', ".$conf->entity ;
|
|
||||||
}
|
|
||||||
if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$user->id;
|
|
||||||
$sql.=')';
|
|
||||||
dol_syslog("import_csv.modules", LOG_DEBUG);
|
|
||||||
|
|
||||||
//print '> '.join(',',$arrayrecord);
|
$resql=$this->db->query($sqlSelect);
|
||||||
//print 'sql='.$sql;
|
if($resql) {
|
||||||
//print '<br>'."\n";
|
$res = $this->db->fetch_object($resql);
|
||||||
|
if($resql->num_rows == 1) {
|
||||||
// Run insert request
|
$lastinsertid = $res->rowid;
|
||||||
if ($sql)
|
$last_insert_id_array[$tablename] = $lastinsertid;
|
||||||
{
|
} else if($resql->num_rows > 1) {
|
||||||
$resql=$this->db->query($sql);
|
$this->errors[$error]['lib']=$langs->trans('MultipleRecordFoundWithTheseFilters', implode($filters, ', '));
|
||||||
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
$this->errors[$error]['type']='SQL';
|
||||||
if ($resql)
|
$error++;
|
||||||
{
|
} else {
|
||||||
//print '.';
|
// No record found with filters, insert will be tried below
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//print 'E';
|
||||||
|
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||||
|
$this->errors[$error]['type']='SQL';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if(!empty($lastinsertid)) {
|
||||||
|
// Build SQL UPDATE request
|
||||||
|
$sqlstart = 'UPDATE '.$tablename;
|
||||||
|
|
||||||
|
$data = array_combine($listfields, $listvalues);
|
||||||
|
$set = array();
|
||||||
|
foreach ($data as $key => $val) {
|
||||||
|
$set[] = $key.' = '.$val;
|
||||||
|
}
|
||||||
|
$sqlstart.= ' SET '.implode(', ', $set);
|
||||||
|
|
||||||
|
if(empty($keyfield)) $keyfield = 'rowid';
|
||||||
|
$sqlend = ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||||
|
|
||||||
|
$sql = $sqlstart.$sqlend;
|
||||||
|
|
||||||
|
// Run update request
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if($resql) {
|
||||||
|
// No error, update has been done. $this->db->db->affected_rows can be 0 if data hasn't changed
|
||||||
|
$updatedone = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//print 'E';
|
||||||
|
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||||
|
$this->errors[$error]['type']='SQL';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update not done, we do insert
|
||||||
|
if(!$error && !$updatedone) {
|
||||||
|
// Build SQL INSERT request
|
||||||
|
$sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key';
|
||||||
|
$sqlend = ') VALUES('.implode(', ', $listvalues).", '".$importid."'";
|
||||||
|
if (! empty($tablewithentity_cache[$tablename])) {
|
||||||
|
$sqlstart.= ', entity';
|
||||||
|
$sqlend.= ', '.$conf->entity;
|
||||||
|
}
|
||||||
|
if (! empty($objimport->array_import_tables_creator[0][$alias])) {
|
||||||
|
$sqlstart.= ', '.$objimport->array_import_tables_creator[0][$alias];
|
||||||
|
$sqlend.=', '.$user->id;
|
||||||
|
}
|
||||||
|
$sql = $sqlstart.$sqlend.')';
|
||||||
|
dol_syslog("import_csv.modules", LOG_DEBUG);
|
||||||
|
|
||||||
|
// Run insert request
|
||||||
|
if ($sql)
|
||||||
{
|
{
|
||||||
//print 'E';
|
$resql=$this->db->query($sql);
|
||||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
||||||
$this->errors[$error]['type']='SQL';
|
if ($resql)
|
||||||
$error++;
|
{
|
||||||
|
$insertdone = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//print 'E';
|
||||||
|
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||||
|
$this->errors[$error]['type']='SQL';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,6 +702,9 @@ class ImportCsv extends ModeleImports
|
|||||||
|
|
||||||
if ($error) break;
|
if ($error) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($updatedone) $this->nbupdate++;
|
||||||
|
if($insertdone) $this->nbinsert++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class modExpenseReport extends DolibarrModules
|
|||||||
$this->rights[1][0] = 771;
|
$this->rights[1][0] = 771;
|
||||||
$this->rights[1][1] = 'Read expense reports (yours and your subordinates)';
|
$this->rights[1][1] = 'Read expense reports (yours and your subordinates)';
|
||||||
$this->rights[1][2] = 'r';
|
$this->rights[1][2] = 'r';
|
||||||
$this->rights[1][3] = 1;
|
$this->rights[1][3] = 0;
|
||||||
$this->rights[1][4] = 'lire';
|
$this->rights[1][4] = 'lire';
|
||||||
|
|
||||||
$this->rights[3][0] = 772;
|
$this->rights[3][0] = 772;
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class modHoliday extends DolibarrModules
|
|||||||
// 'group' to add a tab in group view
|
// 'group' to add a tab in group view
|
||||||
// 'contact' to add a tab in contact 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)
|
// '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
|
// Boxes
|
||||||
$this->boxes = array(); // List of boxes
|
$this->boxes = array(); // List of boxes
|
||||||
|
|||||||
@ -248,6 +248,7 @@ class modProduct extends DolibarrModules
|
|||||||
$this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','p.recuperableonly'=>'^[0|1]$');
|
$this->import_regex_array[$r]=array('p.ref'=>'[^ ]','p.tosell'=>'^[0|1]$','p.tobuy'=>'^[0|1]$','p.fk_product_type'=>'^[0|1]$','p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','p.recuperableonly'=>'^[0|1]$');
|
||||||
$import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
|
$import_sample=array('p.ref'=>"PREF123456",'p.label'=>"My product",'p.description'=>"This is a description example for record",'p.note'=>"Some note",'p.price'=>"100",'p.price_ttc'=>"110",'p.tva_tx'=>'10','p.tosell'=>"0 or 1",'p.tobuy'=>"0 or 1",'p.fk_product_type'=>"0 for product/1 for service",'p.finished'=>'','p.duration'=>"1y",'p.datec'=>'2008-12-31','p.recuperableonly'=>'0 or 1');
|
||||||
$this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample);
|
$this->import_examplevalues_array[$r]=array_merge($import_sample,$import_extrafield_sample);
|
||||||
|
$this->import_updatekeys_array[$r]=array('p.ref'=>'Ref','p.barcode'=>'BarCode');
|
||||||
|
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
@ -276,6 +277,7 @@ class modProduct extends DolibarrModules
|
|||||||
'sp.unitprice'=>'50',
|
'sp.unitprice'=>'50',
|
||||||
'sp.remise_percent'=>'0'
|
'sp.remise_percent'=>'0'
|
||||||
);
|
);
|
||||||
|
$this->import_updatekeys_array[$r]=array('sp.fk_product'=>'ProductOrService','sp.ref_fourn'=>'SupplierRef');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||||
|
|||||||
@ -360,6 +360,7 @@ class modSociete extends DolibarrModules
|
|||||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||||
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
|
$this->import_regex_array[$r]=array('s.status'=>'^[0|1]','s.client'=>'^[0|1|2|3]','s.fournisseur'=>'^[0|1]','s.fk_typent'=>'id@'.MAIN_DB_PREFIX.'c_typent','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
|
||||||
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>'CU01-0001 or empty or "auto"','s.code_fournisseur'=>'SU01-0001 or empty or "auto"','s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.idprof5'=>"",'s.idprof6'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note_private'=>"This is an example of private note for record",'s.note_public'=>"This is an example of public note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789','s.datec'=>"2015-01-01 or 2015-01-01 12:30:00");
|
$this->import_examplevalues_array[$r]=array('s.nom'=>"MyBigCompany",'s.status'=>"0 (closed) or 1 (active)",'s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'0 or 1','s.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'s.code_client'=>'CU01-0001 or empty or "auto"','s.code_fournisseur'=>'SU01-0001 or empty or "auto"','s.address'=>"61 jump street",'s.zip'=>"123456",'s.town'=>"Big town",'s.fk_pays'=>'US, FR, DE...','s.phone'=>"0101010101",'s.fax'=>"0101010102",'s.url'=>"http://mycompany.com",'s.email'=>"test@mycompany.com",'s.siret'=>"",'s.siren'=>"",'s.ape'=>"",'s.idprof4'=>"",'s.idprof5'=>"",'s.idprof6'=>"",'s.tva_intra'=>"FR0123456789",'s.capital'=>"10000",'s.note_private'=>"This is an example of private note for record",'s.note_public'=>"This is an example of public note for record",'s.fk_typent'=>"2",'s.fk_effectif'=>"3","s.fk_forme_juridique"=>"1",'s.fk_prospectlevel'=>'PL_MEDIUM','s.fk_stcomm'=>'0','s.default_lang'=>'en_US','s.barcode'=>'123456789','s.datec'=>"2015-01-01 or 2015-01-01 12:30:00");
|
||||||
|
$this->import_updatekeys_array[$r]=array('s.nom'=>'Name','s.code_client'=>'CustomerCode','s.code_fournisseur'=>'SupplierCode','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode');
|
||||||
|
|
||||||
// Import list of contact and attributes
|
// Import list of contact and attributes
|
||||||
$r++;
|
$r++;
|
||||||
|
|||||||
@ -85,7 +85,7 @@ class modStock extends DolibarrModules
|
|||||||
$this->rights[0][0] = 1001;
|
$this->rights[0][0] = 1001;
|
||||||
$this->rights[0][1] = 'Lire les stocks';
|
$this->rights[0][1] = 'Lire les stocks';
|
||||||
$this->rights[0][2] = 'r';
|
$this->rights[0][2] = 'r';
|
||||||
$this->rights[0][3] = 1;
|
$this->rights[0][3] = 0;
|
||||||
$this->rights[0][4] = 'lire';
|
$this->rights[0][4] = 'lire';
|
||||||
$this->rights[0][5] = '';
|
$this->rights[0][5] = '';
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ class modStock extends DolibarrModules
|
|||||||
$this->rights[3][0] = 1004;
|
$this->rights[3][0] = 1004;
|
||||||
$this->rights[3][1] = 'Lire mouvements de stocks';
|
$this->rights[3][1] = 'Lire mouvements de stocks';
|
||||||
$this->rights[3][2] = 'r';
|
$this->rights[3][2] = 'r';
|
||||||
$this->rights[3][3] = 1;
|
$this->rights[3][3] = 0;
|
||||||
$this->rights[3][4] = 'mouvement';
|
$this->rights[3][4] = 'mouvement';
|
||||||
$this->rights[3][5] = 'lire';
|
$this->rights[3][5] = 'lire';
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009 Meos
|
* Copyright (C) 2009 Meos
|
||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* 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
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -105,7 +106,7 @@ elseif ($modulepart == 'holiday')
|
|||||||
|
|
||||||
if (empty($backtourl))
|
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('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"]);
|
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_free").prop('checked',true);
|
||||||
jQuery("#prod_entry_mode_predef").prop('checked',false);
|
jQuery("#prod_entry_mode_predef").prop('checked',false);
|
||||||
jQuery("#price_ht").show();
|
jQuery("#price_ht").show();
|
||||||
|
jQuery("#multicurrency_price_ht").show();
|
||||||
jQuery("#price_ttc").show(); // May no exists
|
jQuery("#price_ttc").show(); // May no exists
|
||||||
jQuery("#tva_tx").show();
|
jQuery("#tva_tx").show();
|
||||||
jQuery("#buying_price").val('').show();
|
jQuery("#buying_price").val('').show();
|
||||||
@ -717,6 +718,7 @@ function setforpredef() {
|
|||||||
jQuery("#prod_entry_mode_free").prop('checked',false);
|
jQuery("#prod_entry_mode_free").prop('checked',false);
|
||||||
jQuery("#prod_entry_mode_predef").prop('checked',true);
|
jQuery("#prod_entry_mode_predef").prop('checked',true);
|
||||||
jQuery("#price_ht").hide();
|
jQuery("#price_ht").hide();
|
||||||
|
jQuery("#multicurrency_price_ht").hide();
|
||||||
jQuery("#price_ttc").hide(); // May no exists
|
jQuery("#price_ttc").hide(); // May no exists
|
||||||
jQuery("#tva_tx").hide();
|
jQuery("#tva_tx").hide();
|
||||||
jQuery("#buying_price").show();
|
jQuery("#buying_price").show();
|
||||||
|
|||||||
@ -122,6 +122,7 @@ $coldisplay=-1; // We remove first td
|
|||||||
print '></td>';
|
print '></td>';
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
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>';
|
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) {
|
jQuery("#price_ht").keyup(function(event) {
|
||||||
// console.log(event.which); // discard event tag and arrows
|
// 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) {
|
jQuery("#price_ttc").keyup(function(event) {
|
||||||
// console.log(event.which); // discard event tag and arrows
|
// 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
|
<?php
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($conf->margin->enabled))
|
||||||
|
|||||||
@ -313,20 +313,20 @@ print_liste_field_titre('');
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'" size="10">';
|
print '<input type="text" class="flat" name="search_label" value="'.$search_label.'" size="10">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
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 $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">';
|
print '</td><td class="liste_titre" align="right">';
|
||||||
|
|||||||
@ -117,8 +117,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($langs->trans($ecmdir->error), null, 'errors');
|
setEventMessages($langs->trans($ecmdir->error), $ecmdir->errors, 'errors');
|
||||||
setEventMessages($ecmdir->error, $ecmdir->errors, 'errors');
|
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,9 +172,7 @@ if ($action == 'create')
|
|||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
print '</td></tr>'."\n";
|
print '</table>';
|
||||||
|
|
||||||
print '</table><br>';
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|||||||
@ -494,12 +494,13 @@ if ($action == 'delete_section')
|
|||||||
|
|
||||||
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
||||||
{
|
{
|
||||||
print '<table width="100%" class="nobordernopadding">';
|
print '<table width="100%" class="liste noborderbottom">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<!-- Title for manual directories -->'."\n";
|
||||||
print '<td class="liste_titre" align="left" colspan="6">';
|
print '<tr class="liste_titre">'."\n";
|
||||||
|
print '<th class="liste_titre" align="left" colspan="6">';
|
||||||
print ' '.$langs->trans("ECMSections");
|
print ' '.$langs->trans("ECMSections");
|
||||||
print '</td></tr>';
|
print '</th></tr>';
|
||||||
|
|
||||||
$showonrightsize='';
|
$showonrightsize='';
|
||||||
|
|
||||||
@ -720,6 +721,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||||||
|
|
||||||
|
|
||||||
$mode='noajax';
|
$mode='noajax';
|
||||||
|
$url=DOL_URL_ROOT.'/ecm/index.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -480,12 +480,13 @@ if ($action == 'delete_section')
|
|||||||
|
|
||||||
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
|
||||||
{
|
{
|
||||||
print '<table width="100%" class="nobordernopadding">';
|
print '<table width="100%" class="liste noborderbottom">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<!-- Title for auto directories -->'."\n";
|
||||||
print '<td class="liste_titre" align="left" colspan="6">';
|
print '<tr class="liste_titre">'."\n";
|
||||||
|
print '<th class="liste_titre" align="left" colspan="6">';
|
||||||
print ' '.$langs->trans("ECMSections");
|
print ' '.$langs->trans("ECMSections");
|
||||||
print '</td></tr>';
|
print '</th></tr>';
|
||||||
|
|
||||||
$showonrightsize='';
|
$showonrightsize='';
|
||||||
// Auto section
|
// Auto section
|
||||||
|
|||||||
@ -1428,26 +1428,6 @@ else
|
|||||||
//$cols = 3;
|
//$cols = 3;
|
||||||
//include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
|
//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>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
@ -1624,14 +1604,6 @@ else
|
|||||||
print '</tr>';
|
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
|
// Amount
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("AmountHT").'</td>';
|
print '<td>'.$langs->trans("AmountHT").'</td>';
|
||||||
@ -2280,7 +2252,7 @@ print '<div class="fichehalfleft">';
|
|||||||
* Generate documents
|
* Generate documents
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if($user->rights->expensereport->export && $action != 'edit')
|
if($user->rights->expensereport->export && $action != 'create' && $action != 'edit')
|
||||||
{
|
{
|
||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->expensereport->dir_output . "/" . 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">';
|
$morehtmlref='<div class="refidno">';
|
||||||
// Ref customer
|
// Ref customer
|
||||||
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 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->commande->creer, 'string', '', null, null, '', 1);
|
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->ficheinter->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'classify')
|
if ($action != 'classify')
|
||||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
$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.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.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.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("interventions");
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
@ -105,6 +107,7 @@ $form = new Form($db);
|
|||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
$contactstatic=new Contact($db);
|
$contactstatic=new Contact($db);
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
|
$formproject=new FormProjets($db);
|
||||||
|
|
||||||
llxHeader('',$langs->trans("Intervention"));
|
llxHeader('',$langs->trans("Intervention"));
|
||||||
|
|
||||||
@ -112,43 +115,74 @@ llxHeader('',$langs->trans("Intervention"));
|
|||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$object->fetch_thirdparty();
|
||||||
$soc->fetch($object->socid);
|
|
||||||
|
|
||||||
|
|
||||||
$head = fichinter_prepare_head($object);
|
$head = fichinter_prepare_head($object);
|
||||||
dol_fiche_head($head, 'contact', $langs->trans("InterventionCard"), 0, 'intervention');
|
dol_fiche_head($head, 'contact', $langs->trans("InterventionCard"), 0, 'intervention');
|
||||||
|
|
||||||
|
|
||||||
/*
|
// Intervention card
|
||||||
* Fiche intervention synthese pour rappel
|
|
||||||
*/
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$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
|
$morehtmlref='<div class="refidno">';
|
||||||
if ( is_null($object->thirdparty) )
|
// Ref customer
|
||||||
$object->fetch_thirdparty();
|
//$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>';
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, 0, 0, '', '', 1);
|
||||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</div>';
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser=1;
|
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_USER)) $hideaddcontactforuser=1;
|
||||||
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty=1;
|
if (! empty($conf->global->FICHINTER_HIDE_ADD_CONTACT_THIPARTY)) $hideaddcontactforthirdparty=1;
|
||||||
|
|
||||||
// Contacts lines
|
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
$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%">';
|
print '<table class="border" width="100%">';
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
$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>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
$modulepart = 'ficheinter';
|
$modulepart = 'ficheinter';
|
||||||
$permission = $user->rights->ficheinter->creer;
|
$permission = $user->rights->ficheinter->creer;
|
||||||
$permtoedit = $user->rights->ficheinter->creer;
|
$permtoedit = $user->rights->ficheinter->creer;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
/* 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>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -31,7 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
|
|||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load("interventions");
|
$langs->load("interventions");
|
||||||
|
|
||||||
|
$socid=0;
|
||||||
$id = GETPOST('id','int');
|
$id = GETPOST('id','int');
|
||||||
|
$ref=GETPOST('ref','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
@ -39,9 +41,10 @@ $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
|||||||
|
|
||||||
$object = new Fichinter($db);
|
$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"));
|
llxHeader('',$langs->trans("Intervention"));
|
||||||
|
|
||||||
$societe = new Societe($db);
|
$object->fetch_thirdparty();
|
||||||
$societe->fetch($object->socid);
|
$object->info($object->id);
|
||||||
|
|
||||||
$head = fichinter_prepare_head($object);
|
$head = fichinter_prepare_head($object);
|
||||||
dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), 0, 'intervention');
|
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>';
|
print '<table width="100%"><tr><td>';
|
||||||
dol_print_object_info($object);
|
dol_print_object_info($object);
|
||||||
@ -65,5 +118,7 @@ print '</td></tr></table>';
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -60,31 +60,67 @@ $form = new Form($db);
|
|||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$object->fetch_thirdparty();
|
||||||
if ($societe->fetch($object->socid))
|
|
||||||
|
$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);
|
$langs->load("projects");
|
||||||
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
|
if ($user->rights->commande->creer)
|
||||||
print '<table class="border" width="100%">';
|
{
|
||||||
|
if ($action != 'classify')
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
|
$morehtmlref.=' : ';
|
||||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td>';
|
if ($action == 'classify') {
|
||||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
print '</td></tr>';
|
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||||
|
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||||
// Company
|
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td><td>'.$societe->getNomUrl(1).'</td></tr>';
|
$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").'">';
|
||||||
print "</table>";
|
$morehtmlref.='</form>';
|
||||||
|
} else {
|
||||||
print '<br>';
|
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
|
}
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
} else {
|
||||||
|
if (! empty($object->fk_project)) {
|
||||||
dol_fiche_end();
|
$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();
|
llxFooter();
|
||||||
|
|||||||
@ -28,20 +28,24 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
|||||||
|
|
||||||
$langs->load("interventions");
|
$langs->load("interventions");
|
||||||
|
|
||||||
|
$ilink=0;
|
||||||
$var=true;
|
$var=true;
|
||||||
foreach($linkedObjectBlock as $key => $objectlink)
|
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]; ?> >
|
<tr class="<?php echo $trclass; ?>">
|
||||||
<td><?php echo $langs->trans("Intervention"); ?></td>
|
<td><?php echo $langs->trans("Intervention"); ?></td>
|
||||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="center"><?php echo dol_print_date($objectlink->datev,'day'); ?></td>
|
<td align="center"><?php echo dol_print_date($objectlink->datev,'day'); ?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></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>
|
<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>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1333,9 +1333,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* @param int $date_end Date end of service
|
* @param int $date_end Date end of service
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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;
|
global $langs,$mysoc,$conf;
|
||||||
|
|
||||||
@ -1441,17 +1442,19 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
$localtax1_type=$localtaxes_type[0];
|
$localtax1_type=$localtaxes_type[0];
|
||||||
$localtax2_type=$localtaxes_type[2];
|
$localtax2_type=$localtaxes_type[2];
|
||||||
@ -1498,12 +1501,12 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$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->price=$this->line->subprice;
|
||||||
|
|
||||||
$this->line->remise_percent=$remise_percent;
|
$this->line->remise_percent=$remise_percent;
|
||||||
@ -2247,9 +2250,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* @param timestamp $date_end Date end of service
|
* @param timestamp $date_end Date end of service
|
||||||
* @param array $array_options Extrafields array
|
* @param array $array_options Extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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;
|
global $mysoc, $conf;
|
||||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
|
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.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
$pu_tva = $tabprice[4];
|
||||||
|
$pu_ttc = $tabprice[5];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
$localtax1_type=$localtaxes_type[0];
|
$localtax1_type=$localtaxes_type[0];
|
||||||
$localtax2_type=$localtaxes_type[2];
|
$localtax2_type=$localtaxes_type[2];
|
||||||
|
|
||||||
$subprice = price2num($pu,'MU');
|
$subprice = price2num($pu_ht,'MU');
|
||||||
|
|
||||||
$this->line=new CommandeFournisseurLigne($this->db);
|
$this->line=new CommandeFournisseurLigne($this->db);
|
||||||
$this->line->fetch($rowid);
|
$this->line->fetch($rowid);
|
||||||
@ -2330,7 +2338,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$this->line->localtax1_type = $localtaxes_type[0];
|
$this->line->localtax1_type = $localtaxes_type[0];
|
||||||
$this->line->localtax2_type = $localtaxes_type[2];
|
$this->line->localtax2_type = $localtaxes_type[2];
|
||||||
$this->line->remise_percent = $remise_percent;
|
$this->line->remise_percent = $remise_percent;
|
||||||
$this->line->subprice = $pu;
|
$this->line->subprice = $pu_ht;
|
||||||
$this->line->rang = $this->rang;
|
$this->line->rang = $this->rang;
|
||||||
$this->line->info_bits = $info_bits;
|
$this->line->info_bits = $info_bits;
|
||||||
$this->line->total_ht = $total_ht;
|
$this->line->total_ht = $total_ht;
|
||||||
@ -2349,12 +2357,12 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$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->price=$this->line->subprice;
|
||||||
|
|
||||||
$this->line->remise_percent=$remise_percent;
|
$this->line->remise_percent=$remise_percent;
|
||||||
@ -2367,9 +2375,11 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
|
|
||||||
// Mise a jour info denormalisees au niveau facture
|
// Mise a jour info denormalisees au niveau facture
|
||||||
if (! $error)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$this->update_price('','auto');
|
$this->update_price('','auto');
|
||||||
|
$this->db->commit();
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3087,10 +3097,10 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
|||||||
$sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null");
|
$sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null");
|
||||||
$sql.= ", ".($this->fk_multicurrency ? $this->fk_multicurrency : "null");
|
$sql.= ", ".($this->fk_multicurrency ? $this->fk_multicurrency : "null");
|
||||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||||
$sql.= ", ".price2num($this->pu_ht * $this->multicurrency_tx);
|
$sql.= ", ".price2num($this->multicurrency_subprice);
|
||||||
$sql.= ", ".$this->multicurrency_total_ht;
|
$sql.= ", ".price2num($this->multicurrency_total_ht);
|
||||||
$sql.= ", ".$this->multicurrency_total_tva;
|
$sql.= ", ".price2num($this->multicurrency_total_tva);
|
||||||
$sql.= ", ".$this->multicurrency_total_ttc;
|
$sql.= ", ".price2num($this->multicurrency_total_ttc);
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
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");
|
$sql.= ($this->fk_unit ? ", fk_unit='".$this->db->escape($this->fk_unit)."'":", fk_unit=null");
|
||||||
|
|
||||||
// Multicurrency
|
// 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_ht=".price2num($this->multicurrency_total_ht)."";
|
||||||
$sql.= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
|
$sql.= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
|
||||||
$sql.= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
|
$sql.= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
|
||||||
|
|||||||
@ -1310,11 +1310,12 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param int $origin_id id origin document
|
* @param int $origin_id id origin document
|
||||||
|
* @param double $pu_ht_devise Amount in currency
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*
|
*
|
||||||
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
|
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
|
||||||
*/
|
*/
|
||||||
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);
|
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';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
@ -1347,17 +1348,19 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1=price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
$total_localtax1 = $tabprice[9];
|
$total_localtax1 = $tabprice[9];
|
||||||
$total_localtax2 = $tabprice[10];
|
$total_localtax2 = $tabprice[10];
|
||||||
|
$pu_ht = $tabprice[3];
|
||||||
|
|
||||||
// MultiCurrency
|
// MultiCurrency
|
||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
@ -1379,7 +1382,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$this->line->fk_product=$fk_product;
|
$this->line->fk_product=$fk_product;
|
||||||
$this->line->product_type=$type;
|
$this->line->product_type=$type;
|
||||||
$this->line->remise_percent=$remise_percent;
|
$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_start=$date_start;
|
||||||
$this->line->date_end=$date_end;
|
$this->line->date_end=$date_end;
|
||||||
$this->line->ventil=$ventil;
|
$this->line->ventil=$ventil;
|
||||||
@ -1401,7 +1404,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// Multicurrency
|
// Multicurrency
|
||||||
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
$this->line->fk_multicurrency = $this->fk_multicurrency;
|
||||||
$this->line->multicurrency_code = $this->multicurrency_code;
|
$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_ht = $multicurrency_total_ht;
|
||||||
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
$this->line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$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 timestamp $date_end Date end of service
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @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
|
* @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;
|
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);
|
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);
|
$pu = price2num($pu);
|
||||||
$qty = price2num($qty);
|
$qty = price2num($qty);
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
|
$pu_ht_devise = price2num($pu_ht_devise);
|
||||||
|
|
||||||
// Check parameters
|
// 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;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -1499,7 +1504,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
|
$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_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
$total_ttc = $tabprice[2];
|
$total_ttc = $tabprice[2];
|
||||||
@ -1513,6 +1518,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$multicurrency_total_ht = $tabprice[16];
|
$multicurrency_total_ht = $tabprice[16];
|
||||||
$multicurrency_total_tva = $tabprice[17];
|
$multicurrency_total_tva = $tabprice[17];
|
||||||
$multicurrency_total_ttc = $tabprice[18];
|
$multicurrency_total_ttc = $tabprice[18];
|
||||||
|
$pu_ht_devise = $tabprice[19];
|
||||||
|
|
||||||
if (empty($info_bits)) $info_bits=0;
|
if (empty($info_bits)) $info_bits=0;
|
||||||
|
|
||||||
@ -1558,7 +1564,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$line->array_options = $array_options;
|
$line->array_options = $array_options;
|
||||||
|
|
||||||
// Multicurrency
|
// 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_ht = $multicurrency_total_ht;
|
||||||
$line->multicurrency_total_tva = $multicurrency_total_tva;
|
$line->multicurrency_total_tva = $multicurrency_total_tva;
|
||||||
$line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
$line->multicurrency_total_ttc = $multicurrency_total_ttc;
|
||||||
@ -2493,9 +2499,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
$qty = price2num($this->qty);
|
$qty = price2num($this->qty);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! is_numeric($pu) || ! is_numeric($qty)) {
|
if (empty($this->qty)) $this->qty=0;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->product_type < 0) {
|
if ($this->product_type < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -299,6 +299,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$qty = GETPOST('qty'.$predef);
|
$qty = GETPOST('qty'.$predef);
|
||||||
$remise_percent=GETPOST('remise_percent'.$predef);
|
$remise_percent=GETPOST('remise_percent'.$predef);
|
||||||
|
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
@ -322,7 +323,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||||
$error++;
|
$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');
|
setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -410,7 +411,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors');
|
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_ht = price2num($price_ht, 'MU');
|
||||||
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
||||||
@ -441,7 +442,9 @@ if (empty($reshook))
|
|||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
}
|
}
|
||||||
|
|
||||||
$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 = 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, $pu_ht_devise);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print "xx".$tva_tx; exit;
|
//print "xx".$tva_tx; exit;
|
||||||
@ -541,6 +544,8 @@ if (empty($reshook))
|
|||||||
$localtax1_tx=get_localtax($tva_tx,1,$mysoc,$object->thirdparty);
|
$localtax1_tx=get_localtax($tva_tx,1,$mysoc,$object->thirdparty);
|
||||||
$localtax2_tx=get_localtax($tva_tx,2,$mysoc,$object->thirdparty);
|
$localtax2_tx=get_localtax($tva_tx,2,$mysoc,$object->thirdparty);
|
||||||
|
|
||||||
|
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||||
|
|
||||||
// Extrafields Lines
|
// Extrafields Lines
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
@ -568,7 +573,8 @@ if (empty($reshook))
|
|||||||
$date_start,
|
$date_start,
|
||||||
$date_end,
|
$date_end,
|
||||||
$array_options,
|
$array_options,
|
||||||
$_POST['units']
|
$_POST['units'],
|
||||||
|
$pu_ht_devise
|
||||||
);
|
);
|
||||||
unset($_POST['qty']);
|
unset($_POST['qty']);
|
||||||
unset($_POST['type']);
|
unset($_POST['type']);
|
||||||
@ -1401,7 +1407,7 @@ if ($action=='create')
|
|||||||
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
||||||
$mode_reglement_id = $societe->mode_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_private = $object->getDefaultCreateValueFor('note_private');
|
||||||
$note_public = $object->getDefaultCreateValueFor('note_public');
|
$note_public = $object->getDefaultCreateValueFor('note_public');
|
||||||
@ -1594,6 +1600,8 @@ if ($action=='create')
|
|||||||
}
|
}
|
||||||
elseif (! empty($object->id))
|
elseif (! empty($object->id))
|
||||||
{
|
{
|
||||||
|
$result = $object->fetch($id, $ref);
|
||||||
|
|
||||||
$societe = new Fournisseur($db);
|
$societe = new Fournisseur($db);
|
||||||
$result=$societe->fetch($object->socid);
|
$result=$societe->fetch($object->socid);
|
||||||
if ($result < 0) dol_print_error($db);
|
if ($result < 0) dol_print_error($db);
|
||||||
@ -1813,7 +1821,7 @@ elseif (! empty($object->id))
|
|||||||
|
|
||||||
// Author
|
// Author
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("AuthorRequest").'</td>';
|
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>';
|
print '</tr>';
|
||||||
|
|
||||||
// Conditions de reglement par defaut
|
// 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 '<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 '</tr></table>';
|
||||||
print '</td><td>';
|
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);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
} else {
|
} else {
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
$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>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -2672,15 +2688,13 @@ elseif (! empty($object->id))
|
|||||||
|
|
||||||
if ($user->rights->fournisseur->commande->commander && $object->statut == 2)
|
if ($user->rights->fournisseur->commande->commander && $object->statut == 2)
|
||||||
{
|
{
|
||||||
/*
|
// Set status to ordered (action=commande)
|
||||||
* Commander (action=commande)
|
|
||||||
*/
|
|
||||||
print '<!-- form to record supplier order -->'."\n";
|
print '<!-- form to record supplier order -->'."\n";
|
||||||
print '<form name="commande" action="card.php?id='.$object->id.'&action=commande" method="post">';
|
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="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="commande">';
|
print '<input type="hidden" name="action" value="commande">';
|
||||||
print load_fiche_titre($langs->trans("ToOrder"),'','');
|
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 class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
|
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
|
||||||
$date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$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))
|
if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4))
|
||||||
{
|
{
|
||||||
/*
|
// Set status to received (action=livraison)
|
||||||
* Receptionner (action=livraison)
|
|
||||||
*/
|
|
||||||
print '<!-- form to record supplier order received -->'."\n";
|
print '<!-- form to record supplier order received -->'."\n";
|
||||||
print '<form action="card.php?id='.$object->id.'" method="post">';
|
print '<form action="card.php?id='.$object->id.'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="livraison">';
|
print '<input type="hidden" name="action" value="livraison">';
|
||||||
print load_fiche_titre($langs->trans("Receive"),'','');
|
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 class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
||||||
print $form->select_date('','',1,1,'',"commande",1,0,1);
|
print $form->select_date('','',1,1,'',"commande",1,0,1);
|
||||||
|
|||||||
@ -133,38 +133,60 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($object->fetch($id, $ref) > 0)
|
if ($object->fetch($id, $ref) > 0)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$object->fetch_thirdparty();
|
||||||
$soc->fetch($object->socid);
|
|
||||||
|
|
||||||
|
|
||||||
$head = ordersupplier_prepare_head($object);
|
$head = ordersupplier_prepare_head($object);
|
||||||
dol_fiche_head($head, 'contact', $langs->trans("SupplierOrder"), 0, 'order');
|
dol_fiche_head($head, 'contact', $langs->trans("SupplierOrder"), 0, 'order');
|
||||||
|
|
||||||
|
// Supplier order card
|
||||||
/*
|
|
||||||
* Facture synthese pour rappel
|
|
||||||
*/
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
$morehtmlref='<div class="refidno">';
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
// Ref supplier
|
||||||
print '<td colspan="2">';
|
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||||
print '</td>';
|
// Thirdparty
|
||||||
print '</tr>';
|
$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>';
|
||||||
|
|
||||||
// Supplier
|
|
||||||
print '<tr><td>'.$langs->trans("Supplier")."</td>";
|
|
||||||
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print "</table>";
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
print '</div>';
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Contacts lines
|
// Contacts lines
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -65,16 +65,16 @@ $projectid = 0;
|
|||||||
if ($_GET["projectid"])
|
if ($_GET["projectid"])
|
||||||
$projectid = GETPOST("projectid", 'int');
|
$projectid = GETPOST("projectid", 'int');
|
||||||
|
|
||||||
$commande = new CommandeFournisseur($db);
|
$object = new CommandeFournisseur($db);
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref)) {
|
if ($id > 0 || ! empty($ref)) {
|
||||||
$result = $commande->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
if ($result < 0) {
|
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) {
|
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 ++;
|
$error ++;
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
$result = $commande->calcAndSetStatusDispatch($user);
|
$result = $object->calcAndSetStatusDispatch($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -114,9 +114,9 @@ if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANC
|
|||||||
$error ++;
|
$error ++;
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
$result = $commande->calcAndSetStatusDispatch($user);
|
$result = $object->calcAndSetStatusDispatch($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -134,9 +134,9 @@ if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_
|
|||||||
$error ++;
|
$error ++;
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
$result = $commande->calcAndSetStatusDispatch($user);
|
$result = $object->calcAndSetStatusDispatch($user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -174,9 +174,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
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) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,9 +218,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
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) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,9 +229,9 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$result = $commande->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0);
|
$result = $object->calcAndSetStatusDispatch($user, GETPOST('closeopenorder')?1:0);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,11 +240,11 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
|||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Call trigger
|
// Call trigger
|
||||||
|
|
||||||
$result = $commande->call_trigger('ORDER_SUPPLIER_DISPATCH', $user);
|
$result = $object->call_trigger('ORDER_SUPPLIER_DISPATCH', $user);
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($commande->error, $commande->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,25 +275,75 @@ llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_
|
|||||||
|
|
||||||
if ($id > 0 || ! empty($ref)) {
|
if ($id > 0 || ! empty($ref)) {
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($commande->socid);
|
$soc->fetch($object->socid);
|
||||||
|
|
||||||
$author = new User($db);
|
$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");
|
$title = $langs->trans("SupplierOrder");
|
||||||
dol_fiche_head($head, 'dispatch', $title, 0, 'order');
|
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
|
// Ref
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("Ref") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("Ref") . '</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $form->showrefnav($commande, 'ref', '', 1, 'ref', 'ref');
|
print $form->showrefnav($object, 'ref', '', 1, 'ref', 'ref');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -306,29 +356,31 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>' . $langs->trans("Status") . '</td>';
|
print '<td>' . $langs->trans("Status") . '</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $commande->getLibStatut(4);
|
print $object->getLibStatut(4);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
*/
|
||||||
// Date
|
// Date
|
||||||
if ($commande->methode_commande_id > 0) {
|
if ($object->methode_commande_id > 0) {
|
||||||
print '<tr><td>' . $langs->trans("Date") . '</td><td colspan="2">';
|
print '<tr><td class="titlefield">' . $langs->trans("Date") . '</td><td>';
|
||||||
if ($commande->date_commande) {
|
if ($object->date_commande) {
|
||||||
print dol_print_date($commande->date_commande, "dayhourtext") . "\n";
|
print dol_print_date($object->date_commande, "dayhourtext") . "\n";
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
if ($commande->methode_commande) {
|
if ($object->methode_commande) {
|
||||||
print '<tr><td>' . $langs->trans("Method") . '</td><td colspan="2">' . $commande->methode_commande . '</td></tr>';
|
print '<tr><td>' . $langs->trans("Method") . '</td><td>' . $object->methode_commande . '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auteur
|
// Auteur
|
||||||
print '<tr><td>' . $langs->trans("AuthorRequest") . '</td>';
|
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 '</tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
// if ($mesg) print $mesg;
|
// if ($mesg) print $mesg;
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -336,20 +388,20 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER))
|
||||||
$disabled = 0;
|
$disabled = 0;
|
||||||
|
|
||||||
/*
|
// Line of orders
|
||||||
* Lignes de commandes
|
if ($object->statut <= 2 || $object->statut >= 6) {
|
||||||
*/
|
|
||||||
if ($commande->statut <= 2 || $commande->statut >= 6) {
|
|
||||||
print $langs->trans("OrderStatusNotReadyToDispatch");
|
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);
|
$entrepot = new Entrepot($db);
|
||||||
$listwarehouses = $entrepot->list_array(1);
|
$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="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="dispatch">';
|
print '<input type="hidden" name="action" value="dispatch">';
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
// Set $products_dispatched with qty dispatched for each product id
|
// 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 = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
|
$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 .= " 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";
|
$sql .= " GROUP BY l.rowid, cfd.fk_product";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -369,7 +421,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$objd = $db->fetch_object($resql);
|
$objd = $db->fetch_object($resql);
|
||||||
$products_dispatched[$objd->rowid] = price2num($objd->qty, 5);
|
$products_dispatched[$objd->rowid] = price2num($objd->qty, 5);
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -379,7 +431,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$sql .= " p.ref, p.label, p.tobatch";
|
$sql .= " p.ref, p.label, p.tobatch";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
||||||
$sql .= " WHERE l.fk_commande = " . $commande->id;
|
$sql .= " WHERE l.fk_commande = " . $object->id;
|
||||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
$sql .= " AND l.product_type = 0";
|
$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
|
$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;
|
$nbfreeproduct = 0; // Nb of lins of free products/services
|
||||||
$nbproduct = 0;
|
$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;
|
$var = false;
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
@ -423,14 +476,14 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
|
|
||||||
// On n'affiche pas les produits personnalises
|
// On n'affiche pas les produits personnalises
|
||||||
if (! $objp->fk_product > 0) {
|
if (! $objp->fk_product > 0) {
|
||||||
$nbfreeproduct ++;
|
$nbfreeproduct++;
|
||||||
} else {
|
} else {
|
||||||
$remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched
|
$remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched
|
||||||
if ($remaintodispatch < 0)
|
if ($remaintodispatch < 0)
|
||||||
$remaintodispatch = 0;
|
$remaintodispatch = 0;
|
||||||
|
|
||||||
if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) {
|
if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) {
|
||||||
$nbproduct ++;
|
$nbproduct++;
|
||||||
|
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
@ -470,7 +523,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP))
|
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');
|
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
|
||||||
|
|
||||||
// Qty ordered
|
// Qty ordered
|
||||||
print '<td align="right">' . $objp->qty . '</td>';
|
print '<td align="right">' . $objp->qty . '</td>';
|
||||||
|
|
||||||
// Already dispatched
|
// Already dispatched
|
||||||
@ -538,7 +591,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
@ -546,30 +599,35 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "<br/>\n";
|
print '</div>';
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
if ($nbproduct)
|
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 '<br><div class="center">';
|
||||||
print $langs->trans("Comment") . ' : ';
|
print $langs->trans("Comment") . ' : ';
|
||||||
print '<input type="text" size="60" maxlength="128" name="comment" value="';
|
print '<input type="text" class="minwidth200" maxlength="128" name="comment" value="';
|
||||||
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $commande->ref);
|
print $_POST["comment"] ? GETPOST("comment") : $langs->trans("DispatchSupplierOrder", $object->ref);
|
||||||
// print ' / '.$commande->ref_supplier; // Not yet available
|
// print ' / '.$object->ref_supplier; // Not yet available
|
||||||
print '" class="flat"><br>';
|
print '" class="flat"><br>';
|
||||||
|
|
||||||
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
|
print '<input type="checkbox" checked="checked" name="closeopenorder"> '.$checkboxlabel;
|
||||||
|
|
||||||
// print '<div class="center">';
|
|
||||||
print '<br><input type="submit" class="button" value="' . $langs->trans("DispatchVerb") . '"';
|
print '<br><input type="submit" class="button" value="' . $langs->trans("DispatchVerb") . '"';
|
||||||
if (count($listwarehouses) <= 0)
|
if (count($listwarehouses) <= 0)
|
||||||
print ' disabled';
|
print ' disabled';
|
||||||
print '>';
|
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>';
|
print '</form>';
|
||||||
@ -577,6 +635,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
// List of lines already dispatched
|
// List of lines already dispatched
|
||||||
$sql = "SELECT p.ref, p.label,";
|
$sql = "SELECT p.ref, p.label,";
|
||||||
$sql .= " e.rowid as warehouse_id, e.label as entrepot,";
|
$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 .= " FROM " . MAIN_DB_PREFIX . "product as p,";
|
||||||
$sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
|
$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 .= " 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 .= " AND cfd.fk_product = p.rowid";
|
||||||
$sql .= " ORDER BY cfd.rowid ASC";
|
$sql .= " ORDER BY cfd.rowid ASC";
|
||||||
|
|
||||||
@ -594,10 +653,11 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
print "<br/>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ReceivingForSameOrder"));
|
print load_fiche_titre($langs->trans("ReceivingForSameOrder"));
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -666,7 +726,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$disabled = '';
|
$disabled = '';
|
||||||
if ($commande->statut == 5)
|
if ($object->statut == 5)
|
||||||
$disabled = 1;
|
$disabled = 1;
|
||||||
if (empty($objp->status)) {
|
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>';
|
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);
|
$db->free($resql);
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.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);
|
$upload_dir = $conf->fournisseur->dir_output.'/commande/'.dol_sanitizeFileName($object->ref);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -92,6 +93,8 @@ if ($object->id > 0)
|
|||||||
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
|
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
|
||||||
llxHeader('',$langs->trans("Order"),$help_url);
|
llxHeader('',$langs->trans("Order"),$help_url);
|
||||||
|
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$author = new User($db);
|
$author = new User($db);
|
||||||
$author->fetch($object->user_author_id);
|
$author->fetch($object->user_author_id);
|
||||||
|
|
||||||
@ -108,57 +111,67 @@ if ($object->id > 0)
|
|||||||
$totalsize+=$file['size'];
|
$totalsize+=$file['size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Supplier order card
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
// Ref
|
$morehtmlref='<div class="refidno">';
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
// Ref supplier
|
||||||
print '<td colspan="2">';
|
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||||
print '</td>';
|
// Thirdparty
|
||||||
print '</tr>';
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||||
|
// Project
|
||||||
// Fournisseur
|
if (! empty($conf->projet->enabled))
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
$langs->load("projects");
|
||||||
if ($object->date_commande)
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
{
|
if ($user->rights->fournisseur->commande->creer)
|
||||||
print dol_print_date($object->date_commande,"dayhourtext")."\n";
|
{
|
||||||
}
|
if ($action != 'classify')
|
||||||
print "</td></tr>";
|
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||||
|
$morehtmlref.=' : ';
|
||||||
if ($object->methode_commande)
|
if ($action == 'classify') {
|
||||||
{
|
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
|
$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>';
|
||||||
|
|
||||||
// Auteur
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
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 '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
$modulepart = 'commande_fournisseur';
|
$modulepart = 'commande_fournisseur';
|
||||||
$permission = $user->rights->fournisseur->commande->creer;
|
$permission = $user->rights->fournisseur->commande->creer;
|
||||||
$permtoedit = $user->rights->fournisseur->commande->creer;
|
$permtoedit = $user->rights->fournisseur->commande->creer;
|
||||||
@ -169,6 +182,7 @@ if ($object->id > 0)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
header('Location: index.php');
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
@ -130,7 +130,7 @@ if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate";
|
|||||||
$checkedtypetiers=0;
|
$checkedtypetiers=0;
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'cf.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'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),
|
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
|
||||||
'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1),
|
'u.login'=>array('label'=>$langs->trans("AuthorRequest"), 'checked'=>1),
|
||||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), '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 ($search_refsupp) $sql.= natural_search("cf.ref_supplier", $search_refsupp);
|
||||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
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;
|
if ($billed != '' && $billed >= 0) $sql .= " AND cf.billed = ".$billed;
|
||||||
|
|
||||||
//Required triple check because statut=0 means draft filter
|
//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);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
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['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['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['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_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.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);
|
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
|
// Status billed
|
||||||
if (! empty($arrayfields['cf.billed']['checked']))
|
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 $form->selectyesno('billed', $billed, 1, 0, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -757,7 +756,7 @@ if ($resql)
|
|||||||
$userstatic->firstname = $obj->firstname;
|
$userstatic->firstname = $obj->firstname;
|
||||||
$userstatic->login = $obj->login;
|
$userstatic->login = $obj->login;
|
||||||
$userstatic->photo = $obj->photo;
|
$userstatic->photo = $obj->photo;
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['u.login']['checked']))
|
||||||
{
|
{
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
if ($userstatic->id) print $userstatic->getNomUrl(1);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
@ -74,8 +74,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$object->fetch_thirdparty();
|
||||||
$soc->fetch($object->socid);
|
|
||||||
|
|
||||||
$author = new User($db);
|
$author = new User($db);
|
||||||
$author->fetch($object->user_author_id);
|
$author->fetch($object->user_author_id);
|
||||||
@ -85,61 +84,63 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$title=$langs->trans("SupplierOrder");
|
$title=$langs->trans("SupplierOrder");
|
||||||
dol_fiche_head($head, 'note', $title, 0, 'order');
|
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>';
|
||||||
* 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>';
|
$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>';
|
||||||
|
|
||||||
// Ref
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
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 '<div class="fichecenter">';
|
||||||
print '<tr>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
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)
|
$cssclass="titlefield";
|
||||||
{
|
|
||||||
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;
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -804,6 +804,7 @@ if (empty($reshook))
|
|||||||
$localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
|
$localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
|
||||||
$localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
|
$localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
|
||||||
$remise_percent=GETPOST('remise_percent');
|
$remise_percent=GETPOST('remise_percent');
|
||||||
|
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||||
|
|
||||||
// Extrafields Lines
|
// Extrafields Lines
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$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)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
unset($_POST['label']);
|
unset($_POST['label']);
|
||||||
@ -875,6 +876,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$qty = GETPOST('qty'.$predef);
|
$qty = GETPOST('qty'.$predef);
|
||||||
$remise_percent=GETPOST('remise_percent'.$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_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'));
|
$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');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||||
$error++;
|
$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');
|
setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -917,7 +919,7 @@ if (empty($reshook))
|
|||||||
$error++;
|
$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;
|
$idprod=0;
|
||||||
$productsupplier=new ProductFournisseur($db);
|
$productsupplier=new ProductFournisseur($db);
|
||||||
@ -966,7 +968,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors');
|
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_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||||
$tva_tx = str_replace('*', '', $tva_tx);
|
$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
|
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
|
||||||
}
|
}
|
||||||
$price_base_type = 'HT';
|
$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;
|
//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 '<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 '</tr></table>';
|
||||||
print '</td><td colspan="3">';
|
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);
|
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||||
} else {
|
} else {
|
||||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
$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>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user