| '.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).' | ';
print ''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).' | ';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index c75589c1aa0..085b9196820 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -95,6 +95,7 @@ $search_availability = GETPOST('search_availability', 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
$search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int');
+$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
@@ -189,6 +190,7 @@ $arrayfields = array(
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
+ 'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0),
'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0),
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
@@ -277,6 +279,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_categ_cus = 0;
$search_fk_cond_reglement = '';
$search_fk_shipping_method = '';
+ $search_fk_input_reason = '';
$search_fk_mode_reglement = '';
}
if ($object_statut != '') {
@@ -414,7 +417,7 @@ $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_tt
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.note_public, p.note_private,';
-$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,';
+$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql .= ' u.login';
if (!$user->rights->societe->client->voir && !$socid) {
@@ -547,6 +550,9 @@ if ($search_fk_cond_reglement > 0) {
if ($search_fk_shipping_method > 0) {
$sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method);
}
+if ($search_fk_input_reason > 0) {
+ $sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason);
+}
if ($search_fk_mode_reglement > 0) {
$sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement);
}
@@ -735,6 +741,9 @@ if ($resql) {
if ($search_fk_shipping_method > 0) {
$param .= '&search_fk_shipping_method='.$search_fk_shipping_method;
}
+ if ($search_fk_input_reason > 0) {
+ $param .= '&search_fk_input_reason='.$search_fk_input_reason;
+ }
if ($search_fk_mode_reglement > 0) {
$param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement;
}
@@ -983,6 +992,12 @@ if ($resql) {
$form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1);
print '';
}
+ // Source - Input reason
+ if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
+ print '';
+ $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1);
+ print ' | ';
+ }
// Payment term
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '';
@@ -1169,6 +1184,9 @@ if ($resql) {
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder);
}
+ if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
+ print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder);
+ }
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
}
@@ -1473,7 +1491,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
- //Shipping Method
+ // Shipping Method
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print ' | ';
$form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
@@ -1482,6 +1500,17 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
+ // Source - input reason
+ if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
+ print ' | ';
+ if ($obj->fk_input_reason > 0) {
+ print $form->cache_demand_reason[$obj->fk_input_reason]['label'];
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
// Payment terms
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '';
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 375ba4a53ff..84a7d2376c1 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -490,7 +490,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'classifyunbilled' && $usercancreate) {
- $ret = $object->classifyUnBilled();
+ $ret = $object->classifyUnBilled($user);
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index aac06dc4775..4d5f75c7c24 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -2962,11 +2962,12 @@ class Commande extends CommonOrder
/**
* Classify the order as not invoiced
*
- * @return int <0 if ko, >0 if ok
+ * @param User $user Object user making the change
+ * @param int $notrigger 1=Does not execute triggers, 0=execute triggers
+ * @return int <0 if ko, >0 if ok
*/
- public function classifyUnBilled()
+ public function classifyUnBilled(User $user, $notrigger = 0)
{
- global $conf, $user, $langs;
$error = 0;
$this->db->begin();
@@ -2981,12 +2982,14 @@ class Commande extends CommonOrder
$this->billed = 1;
}
- // Call trigger
- $result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user);
- if ($result < 0) {
- $error++;
+ if (!$notrigger && empty($error)) {
+ // Call trigger
+ $result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user);
+ if ($result < 0) {
+ $error++;
+ }
+ // End call triggers
}
- // End call triggers
if (!$error) {
$this->billed = 0;
diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php
index 27dfe941f88..d19ccbed908 100644
--- a/htdocs/compta/bank/various_payment/card.php
+++ b/htdocs/compta/bank/various_payment/card.php
@@ -341,8 +341,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
/* ************************************************************************** */
if ($action == 'create') {
// Update fields properties in realtime
- if (!empty($conf->use_javascript_ajax))
- {
+ if (!empty($conf->use_javascript_ajax)) {
print "\n".' |