FIX Several fixes on the management of minimal amount for orders
This commit is contained in:
parent
b25a0ca672
commit
ff05997f0a
@ -181,7 +181,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setorder_min_amount')
|
if ($action == 'setorder_min_amount')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->order_min_amount=GETPOST('order_min_amount');
|
$object->order_min_amount=price2num(GETPOST('order_min_amount','alpha'));
|
||||||
$result=$object->update($object->id, $user);
|
$result=$object->update($object->id, $user);
|
||||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -423,15 +423,21 @@ if ($object->id > 0)
|
|||||||
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr class="nowrap">';
|
if ($object->client)
|
||||||
print '<td>';
|
{
|
||||||
print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
|
if (! empty($conf->commande->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
||||||
print '</td><td>';
|
{
|
||||||
print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
print '<!-- Minimim amount for orders -->'."\n";
|
||||||
|
print '<tr class="nowrap">';
|
||||||
print '</td>';
|
print '<td>';
|
||||||
print '</tr>';
|
print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
|
||||||
|
print '</td><td>';
|
||||||
|
print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2387,7 +2387,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
// Total HT
|
// Total HT
|
||||||
$alert = '';
|
$alert = '';
|
||||||
if($object->total_ht < $object->thirdparty->order_min_amount) {
|
if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) {
|
||||||
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
||||||
}
|
}
|
||||||
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||||
|
|||||||
@ -109,7 +109,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setsupplier_order_min_amount')
|
if ($action == 'setsupplier_order_min_amount')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->supplier_order_min_amount=GETPOST('supplier_order_min_amount');
|
$object->supplier_order_min_amount=price2num(GETPOST('supplier_order_min_amount','alpha'));
|
||||||
$result=$object->update($object->id, $user);
|
$result=$object->update($object->id, $user);
|
||||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -298,15 +298,17 @@ if ($object->id > 0)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="nowrap">';
|
if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
||||||
print '<td>';
|
{
|
||||||
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
|
print '<tr class="nowrap">';
|
||||||
print '</td><td>';
|
print '<td>';
|
||||||
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
print $form->editfieldkey("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer);
|
||||||
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
|
print '</td><td>';
|
||||||
|
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||||
print '</td>';
|
print $form->editfieldval("OrderMinAmount",'supplier_order_min_amount',$object->supplier_order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->supplier_order_min_amount != '' ? price($object->supplier_order_min_amount) : ''));
|
||||||
print '</tr>';
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if (! empty($conf->categorie->enabled))
|
if (! empty($conf->categorie->enabled))
|
||||||
|
|||||||
@ -2116,7 +2116,7 @@ elseif (! empty($object->id))
|
|||||||
|
|
||||||
// Total
|
// Total
|
||||||
$alert = '';
|
$alert = '';
|
||||||
if($object->total_ht < $object->thirdparty->supplier_order_min_amount) {
|
if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) {
|
||||||
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount));
|
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount));
|
||||||
}
|
}
|
||||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans("AmountHT").'</td>';
|
print '<tr><td class="titlefieldmiddle">'.$langs->trans("AmountHT").'</td>';
|
||||||
|
|||||||
@ -424,11 +424,10 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region
|
|||||||
// We'll need this table joined to the select in order to filter by categ
|
// We'll need this table joined to the select in order to filter by categ
|
||||||
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||||
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||||
$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
|
||||||
// We'll need this table joined to the select in order to filter by sale
|
// We'll need this table joined to the select in order to filter by sale
|
||||||
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
||||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
|||||||
@ -23,10 +23,10 @@ if (empty($conf) || ! is_object($conf))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sale representative
|
// Sale representative
|
||||||
print '<tr><td>';
|
print '<tr><td class="titlefield">';
|
||||||
print $langs->trans('SalesRepresentatives');
|
print $langs->trans('SalesRepresentatives');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td colspan="3">';
|
print '<td>';
|
||||||
|
|
||||||
$listsalesrepresentatives=$object->getSalesRepresentatives($user);
|
$listsalesrepresentatives=$object->getSalesRepresentatives($user);
|
||||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user