';
diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php
index e3c3c285966..74be200945f 100644
--- a/htdocs/cashdesk/tpl/liste_articles.tpl.php
+++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php
@@ -18,8 +18,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || !is_object($langs))
-{
+if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
@@ -48,10 +47,10 @@ $societe->fetch($thirdpartyid);
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
$tab_size = count($tab);
-if ($tab_size <= 0) print '
';
-else {
- for ($i = 0; $i < $tab_size; $i++)
- {
+if ($tab_size <= 0) {
+ print '
'."\n");
echo ('
'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'
'."\n");
diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php
index 1e347f4d01e..67891aa67cf 100644
--- a/htdocs/cashdesk/tpl/menu.tpl.php
+++ b/htdocs/cashdesk/tpl/menu.tpl.php
@@ -20,8 +20,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || !is_object($langs))
-{
+if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
@@ -37,27 +36,23 @@ include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
$companyLink = $company->getNomUrl(1);
}*/
-if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
-{
+if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$bankcash = new Account($db);
$bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]);
$bankcash->label = $bankcash->ref;
$bankcashLink = $bankcash->getNomUrl(1);
}
-if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
-{
+if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$bankcb = new Account($db);
$bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]);
$bankcbLink = $bankcb->getNomUrl(1);
}
-if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
-{
+if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$bankcheque = new Account($db);
$bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]);
$bankchequeLink = $bankcheque->getNomUrl(1);
}
-if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled))
-{
+if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled)) {
$warehouse = new Entrepot($db);
$warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]);
$warehouseLink = $warehouse->getNomUrl(1);
@@ -87,8 +82,7 @@ print '';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'
';
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'
';*/
print '
';
-if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
-{
+if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
}
print '
';
diff --git a/htdocs/cashdesk/tpl/ticket.tpl.php b/htdocs/cashdesk/tpl/ticket.tpl.php
index 101ea687e7b..9220e3daad4 100644
--- a/htdocs/cashdesk/tpl/ticket.tpl.php
+++ b/htdocs/cashdesk/tpl/ticket.tpl.php
@@ -18,8 +18,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || !is_object($langs))
-{
+if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
@@ -38,82 +37,81 @@ $object->fetch($facid);
?>
-
-
trans('PrintTicket') ?>
-
+
+
trans('PrintTicket') ?>
+
-
- logo_small).'">'; ?>
-
-
-
name; ?>
-
-
+
+ logo_small).'">'; ?>
+
+
+
name; ?>
+
+
-
';
print $object->ref;
?>
-
+
-
+
- | trans("Code"); ?> |
- trans("Label"); ?> |
- trans("Qty"); ?> |
- trans("Discount").' (%)'; ?> |
- trans("TotalHT"); ?> |
+ trans("Code"); ?> |
+ trans("Label"); ?> |
+ trans("Qty"); ?> |
+ trans("Discount").' (%)'; ?> |
+ trans("TotalHT"); ?> |
-
-
-
+
+
-
- |
- |
- |
- |
- currency); ?> |
-
-
+ |
+ |
+ |
+ |
+ currency); ?> |
+
+
-
+
- | trans("TotalHT"); ?> |
- amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?> |
+ trans("TotalHT"); ?> |
+ amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?> |
- | trans("TotalVAT").' | '.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?> |
+ trans("TotalVAT").' | '.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?> |
- | trans("TotalTTC").' | '.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?> |
+ trans("TotalTTC").' | '.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?> |
trans("Close"); ?>
diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php
index cc558cca058..c2a9124f300 100644
--- a/htdocs/cashdesk/tpl/validation1.tpl.php
+++ b/htdocs/cashdesk/tpl/validation1.tpl.php
@@ -17,8 +17,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || !is_object($langs))
-{
+if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
@@ -47,25 +46,27 @@ if ($obj_facturation->amountVat()) {
| trans("TotalTTC"); ?> | amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?> |
| trans("PaymentMode"); ?> |
getSetPaymentMode())
- {
+ switch ($obj_facturation->getSetPaymentMode()) {
case 'ESP':
echo $langs->trans("Cash");
$filtre = 'courant=2';
- if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))
+ if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
+ }
break;
case 'CB':
echo $langs->trans("CreditCard");
$filtre = 'courant=1';
- if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))
+ if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
+ }
break;
case 'CHQ':
echo $langs->trans("Cheque");
$filtre = 'courant=1';
- if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))
+ if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
+ }
break;
case 'DIF':
echo $langs->trans("Reported");
diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php
index 8b3ca9c76d5..d89edfdc41a 100644
--- a/htdocs/cashdesk/tpl/validation2.tpl.php
+++ b/htdocs/cashdesk/tpl/validation2.tpl.php
@@ -18,8 +18,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || !is_object($langs))
-{
+if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
diff --git a/htdocs/cashdesk/validation_ticket.php b/htdocs/cashdesk/validation_ticket.php
index 28ad91dc4e7..0c32dfa8c44 100644
--- a/htdocs/cashdesk/validation_ticket.php
+++ b/htdocs/cashdesk/validation_ticket.php
@@ -33,8 +33,7 @@ $hookmanager->initHooks(array('cashdeskTplTicket'));
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $obj_facturation);
-if (empty($reshook))
-{
+if (empty($reshook)) {
require 'tpl/ticket.tpl.php';
}
diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php
index da320c7d855..b9ad0d94a02 100644
--- a/htdocs/cashdesk/validation_verif.php
+++ b/htdocs/cashdesk/validation_verif.php
@@ -36,8 +36,7 @@ $obj_facturation = unserialize($_SESSION['serObjFacturation']);
$action = GETPOST('action', 'aZ09');
$bankaccountid = GETPOST('cashdeskbank');
-switch ($action)
-{
+switch ($action) {
default:
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
break;
@@ -55,15 +54,18 @@ switch ($action)
// To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here
// and restore values just after
$sav_FACTURE_ADDON = '';
- if (!empty($conf->global->POS_ADDON))
- {
+ if (!empty($conf->global->POS_ADDON)) {
$sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
$conf->global->FACTURE_ADDON = $conf->global->POS_ADDON;
// To force prefix only for POS with terre module
- if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
+ if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) {
+ $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
+ }
// To force prefix only for POS with mars module
- if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
+ if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) {
+ $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
+ }
// To force rule only for POS with mercure
//...
}
@@ -71,8 +73,7 @@ switch ($action)
$num = $invoice->getNextNumRef($company);
// Restore save values
- if (!empty($sav_FACTURE_ADDON))
- {
+ if (!empty($sav_FACTURE_ADDON)) {
$conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
}
@@ -120,14 +121,12 @@ switch ($action)
$heure = dol_print_date($now, 'hour');
$note = '';
- if (!is_object($obj_facturation))
- {
+ if (!is_object($obj_facturation)) {
dol_print_error('', 'Empty context');
exit;
}
- switch ($obj_facturation->getSetPaymentMode())
- {
+ switch ($obj_facturation->getSetPaymentMode()) {
case 'DIF':
$mode_reglement_id = 0;
//$cond_reglement_id = dol_getIdFromCode($db,'RECEP','cond_reglement','code','rowid')
@@ -151,8 +150,12 @@ switch ($action)
$cond_reglement_id = 0;
break;
}
- if (empty($mode_reglement_id)) $mode_reglement_id = 0; // If mode_reglement_id not found
- if (empty($cond_reglement_id)) $cond_reglement_id = 0; // If cond_reglement_id not found
+ if (empty($mode_reglement_id)) {
+ $mode_reglement_id = 0; // If mode_reglement_id not found
+ }
+ if (empty($cond_reglement_id)) {
+ $cond_reglement_id = 0; // If cond_reglement_id not found
+ }
$note .= $_POST['txtaNotes'];
dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
@@ -175,8 +178,7 @@ switch ($action)
// Loop on each line into cart
$tab_liste_size = count($tab_liste);
- for ($i = 0; $i < $tab_liste_size; $i++)
- {
+ for ($i = 0; $i < $tab_liste_size; $i++) {
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
$vat_rate = $tmp['rate'];
$vat_npr = $tmp['npr'];
@@ -218,32 +220,32 @@ switch ($action)
//print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit;
// Si paiement differe ...
- if ($obj_facturation->getSetPaymentMode() == 'DIF')
- {
+ if ($obj_facturation->getSetPaymentMode() == 'DIF') {
$resultcreate = $invoice->create($user, 0, dol_stringtotime($obj_facturation->paiementLe()));
- if ($resultcreate > 0)
- {
+ if ($resultcreate > 0) {
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
- if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
+ if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
+ $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
+ }
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
- if ($warehouseidtodecrease > 0)
- {
+ if ($warehouseidtodecrease > 0) {
// Decrease
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
// Loop on each line
$cpt = count($invoice->lines);
- for ($i = 0; $i < $cpt; $i++)
- {
- if ($invoice->lines[$i]->fk_product > 0)
- {
+ for ($i = 0; $i < $cpt; $i++) {
+ if ($invoice->lines[$i]->fk_product > 0) {
$mouvP = new MouvementStock($db);
$mouvP->origin = &$invoice;
// We decrease stock for product
- if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
- else $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
+ if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
+ $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
+ } else {
+ $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
+ }
if ($result < 0) {
$error++;
}
@@ -258,29 +260,30 @@ switch ($action)
$id = $invoice->id;
} else {
$resultcreate = $invoice->create($user, 0, 0);
- if ($resultcreate > 0)
- {
+ if ($resultcreate > 0) {
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
- if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
+ if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
+ $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
+ }
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
- if ($warehouseidtodecrease > 0)
- {
+ if ($warehouseidtodecrease > 0) {
// Decrease
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
// Loop on each line
$cpt = count($invoice->lines);
- for ($i = 0; $i < $cpt; $i++)
- {
- if ($invoice->lines[$i]->fk_product > 0)
- {
+ for ($i = 0; $i < $cpt; $i++) {
+ if ($invoice->lines[$i]->fk_product > 0) {
$mouvP = new MouvementStock($db);
$mouvP->origin = &$invoice;
// We decrease stock for product
- if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
- else $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
+ if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
+ $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
+ } else {
+ $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
+ }
if ($result < 0) {
setEventMessages($mouvP->error, $mouvP->errors, 'errors');
$error++;
@@ -301,26 +304,21 @@ switch ($action)
$payment->num_payment = '';
$paiement_id = $payment->create($user);
- if ($paiement_id > 0)
- {
- if (!$error)
- {
+ if ($paiement_id > 0) {
+ if (!$error) {
$result = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccountid, '', '');
- if (!$result > 0)
- {
+ if (!$result > 0) {
$errmsg = $paiement->error;
$error++;
}
}
- if (!$error)
- {
+ if (!$error) {
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
- && $obj_facturation->getSetPaymentMode() != 'DIFF')
- {
+ && $obj_facturation->getSetPaymentMode() != 'DIFF') {
// We set status to paid
$result = $invoice->setPaid($user);
- //print 'set paid';exit;
+ //print 'set paid';exit;
}
}
} else {
@@ -334,8 +332,7 @@ switch ($action)
}
- if (!$error)
- {
+ if (!$error) {
$db->commit();
$redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
} else {
|