Skip to content

Commit

Permalink
Close #16395 - Can filter on proposal source in list
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 1, 2021
1 parent d4512c4 commit f1f950e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 23 deletions.
36 changes: 18 additions & 18 deletions htdocs/comm/propal/card.php
Expand Up @@ -2113,6 +2113,24 @@
print '</td>';
print '</tr>';

// Payment mode
print '<tr>';
print '<td class="valuefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td class="valuefieldcreate">';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';

// Delivery date
$langs->load('deliveries');
print '<tr><td>';
Expand Down Expand Up @@ -2200,24 +2218,6 @@
print '</td>';
print '</tr>';

// Payment mode
print '<tr>';
print '<td class="valuefield">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td class="valuefieldcreate">';
if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';

// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
// Multicurrency code
Expand Down
33 changes: 31 additions & 2 deletions htdocs/comm/propal/list.php
Expand Up @@ -95,6 +95,7 @@
$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');
Expand Down Expand Up @@ -189,6 +190,7 @@
'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),
Expand Down Expand Up @@ -277,6 +279,7 @@
$search_categ_cus = 0;
$search_fk_cond_reglement = '';
$search_fk_shipping_method = '';
$search_fk_input_reason = '';
$search_fk_mode_reglement = '';
}
if ($object_statut != '') {
Expand Down Expand Up @@ -414,7 +417,7 @@
$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) {
Expand Down Expand Up @@ -547,6 +550,9 @@
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);
}
Expand Down Expand Up @@ -735,6 +741,9 @@
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;
}
Expand Down Expand Up @@ -983,6 +992,12 @@
$form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1);
print '</td>';
}
// Source - Input reason
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print '<td class="liste_titre">';
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1);
print '</td>';
}
// Payment term
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '<td class="liste_titre">';
Expand Down Expand Up @@ -1169,6 +1184,9 @@
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);
}
Expand Down Expand Up @@ -1473,7 +1491,7 @@
$totalarray['nbfield']++;
}
}
//Shipping Method
// Shipping Method
if (!empty($arrayfields['p.fk_shipping_method']['checked'])) {
print '<td>';
$form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
Expand All @@ -1482,6 +1500,17 @@
$totalarray['nbfield']++;
}
}
// Source - input reason
if (!empty($arrayfields['p.fk_input_reason']['checked'])) {
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($form->cache_demand_reason[$obj->fk_input_reason]['label']).'">';
if ($obj->fk_input_reason > 0) {
print $form->cache_demand_reason[$obj->fk_input_reason]['label'];
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Payment terms
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
print '<td>';
Expand Down
8 changes: 5 additions & 3 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -3729,15 +3729,17 @@ public function loadCacheInputReason()
* @param string $htmlname Nom de la zone select
* @param string $exclude To exclude a code value (Example: SRC_PROP)
* @param int $addempty Add an empty entry
* @param string $morecss Add more css to the HTML select component
* @param int $notooltip Do not show the tooltip for admin
* @return void
*/
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0)
public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0)
{
global $langs, $user;

$this->loadCacheInputReason();

print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
if ($addempty) {
print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
}
Expand All @@ -3756,7 +3758,7 @@ public function selectInputReason($selected = '', $htmlname = 'demandreasonid',
print '</option>';
}
print '</select>';
if ($user->admin) {
if ($user->admin && empty($notooltip)) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select_'.$htmlname);
Expand Down

0 comments on commit f1f950e

Please sign in to comment.