Billing of supplier or customer order is a process that can be done in
parallel with shipment or reception, so we show the status on another field into lists.
This commit is contained in:
parent
bb627e32d3
commit
c55d11869b
@ -34,7 +34,7 @@ $langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedCommercialProposals'));
|
||||
print load_fiche_titre($langs->trans('RelatedCommercialProposals'), '', '');
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
|
||||
@ -1062,7 +1062,7 @@ class Commande extends CommonOrder
|
||||
$this->demand_reason_id = $object->demand_reason_id;
|
||||
$this->date_livraison = $object->date_livraison;
|
||||
$this->shipping_method_id = $object->shipping_method_id;
|
||||
$this->warehouse_id = $object->warehouse_id;
|
||||
$this->warehouse_id = $object->warehouse_id;
|
||||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
@ -2887,7 +2887,8 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidated');
|
||||
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').' - '.$langs->trans("Billed");
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
@ -2896,7 +2897,8 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_VALIDATED) return $langs->trans('StatusOrderValidatedShort');
|
||||
if ($statut==self::STATUS_ACCEPTED) return $langs->trans('StatusOrderSentShort');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed').' - '.$langs->trans("Billed");
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
@ -2905,7 +2907,8 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort');
|
||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBillShort');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessedShort');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').' - '.$langs->trans("Billed"),'statut6').' '.$langs->trans('StatusOrderProcessed').' - '.$langs->trans("Billed");
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessedShort');
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
@ -2914,7 +2917,8 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1');
|
||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort'),'statut3');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed').' - '.$langs->trans("Billed"),'statut6');
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
@ -2923,7 +2927,8 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_VALIDATED) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidated');
|
||||
if ($statut==self::STATUS_ACCEPTED) return img_picto($langs->trans('StatusOrderSentShort'),'statut3').' '.$langs->trans('StatusOrderSent');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBill');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessed');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill').' - '.$langs->trans("Billed"),'statut6').' '.$langs->trans('StatusOrderToBill').' - '.$langs->trans("Billed");
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessed');
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
@ -2932,7 +2937,8 @@ class Commande extends CommonOrder
|
||||
if ($statut==self::STATUS_VALIDATED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderValidatedShort').' </span>'.img_picto($langs->trans('StatusOrderValidated'),'statut1');
|
||||
if ($statut==self::STATUS_ACCEPTED) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderSentShort').' </span>'.img_picto($langs->trans('StatusOrderSent'),'statut3');
|
||||
if ($statut==self::STATUS_CLOSED && (! $billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' </span>'.img_picto($langs->trans('StatusOrderToBill'),'statut7');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').' </span>'.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
|
||||
if ($statut==self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderToBillShort').' - '.$langs->trans("Billed").' </span>'.img_picto($langs->trans('StatusOrderToBill').' - '.$langs->trans("Billed"),'statut6');
|
||||
if ($statut==self::STATUS_CLOSED && (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return '<span class="hideonsmartphone">'.$langs->trans('StatusOrderProcessedShort').' </span>'.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php';
|
||||
$langs->load('orders');
|
||||
$langs->load('deliveries');
|
||||
$langs->load('companies');
|
||||
$langs->load('compta');
|
||||
|
||||
$orderyear=GETPOST("orderyear","int");
|
||||
$ordermonth=GETPOST("ordermonth","int");
|
||||
@ -56,6 +57,7 @@ $search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_total_ht=GETPOST('search_total_ht','alpha');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
$billed = GETPOST('billed','int');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
||||
@ -90,6 +92,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$ordermonth='';
|
||||
$deliverymonth='';
|
||||
$deliveryyear='';
|
||||
$viewstatut='';
|
||||
$billed='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@ -151,6 +155,7 @@ if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($billed != '' && $billed >= 0) $sql.=' AND c.facture = '.$billed;
|
||||
if ($viewstatut <> '')
|
||||
{
|
||||
if ($viewstatut < 4 && $viewstatut > -3)
|
||||
@ -336,7 +341,8 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print_liste_field_titre($langs->trans('Billed'),$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,'');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -366,9 +372,12 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
$liststatus=array('0'=>$langs->trans("StatusOrderDraftShort"), '1'=>$langs->trans("StatusOrderValidated"), '2'=>$langs->trans("StatusOrderSentShort"), '3'=>$langs->trans("StatusOrderToBill"), '4'=>$langs->trans("StatusOrderProcessed"), '-1'=>$langs->trans("StatusOrderCanceledShort"));
|
||||
$liststatus=array('0'=>$langs->trans("StatusOrderDraftShort"), '1'=>$langs->trans("StatusOrderValidated"), '2'=>$langs->trans("StatusOrderSentShort"), '3'=>$langs->trans("StatusOrderDelivered"), '-1'=>$langs->trans("StatusOrderCanceledShort"));
|
||||
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print $form->selectyesno('billed', $billed, 1, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><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")).'">';
|
||||
print '<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")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -575,6 +584,9 @@ if ($resql)
|
||||
// Statut
|
||||
print '<td align="right" class="nowrap">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).'</td>';
|
||||
|
||||
// Billed
|
||||
print '<td align="center">'.yn($objp->facturee).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -593,6 +605,7 @@ if ($resql)
|
||||
print '<td align="right" class="nowrap">'.price($total).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("orders");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedCustomerOrders'));
|
||||
print load_fiche_titre($langs->trans('RelatedCustomerOrders'), '', '');
|
||||
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
|
||||
@ -30,7 +30,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("bills");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans("RelatedCustomerInvoices"));
|
||||
print load_fiche_titre($langs->trans("RelatedCustomerInvoices"), '', '');
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
|
||||
@ -26,7 +26,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("contracts");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedContracts'));
|
||||
print load_fiche_titre($langs->trans('RelatedContracts'), '', '');
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
|
||||
@ -5094,7 +5094,7 @@ class Form
|
||||
* @param string $value Pre-selected value
|
||||
* @param int $option 0 return yes/no, 1 return 1/0
|
||||
* @param bool $disabled true or false
|
||||
* @param useempty $useempty 1=Add empty line
|
||||
* @param int $useempty 1=Add empty line
|
||||
* @return mixed See option
|
||||
*/
|
||||
function selectyesno($htmlname,$value='',$option=0,$disabled=false,$useempty='')
|
||||
|
||||
@ -57,7 +57,7 @@ class FormOrder
|
||||
{
|
||||
print '<select class="flat" name="'.$hmlname.'">';
|
||||
print '<option value="-1"> </option>';
|
||||
$statustohow=array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6,7','9'=>'9'); // 7 is same label than 6. 8 does not exist.
|
||||
$statustohow=array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6,7','9'=>'9'); // 7 is same label than 6. 8 does not exists (billed is another field)
|
||||
|
||||
foreach($statustohow as $key => $value)
|
||||
{
|
||||
|
||||
@ -698,8 +698,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders" && ! empty($conf->expedition->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); // The translation key is StatusOrderToBill but it means StatusDelivered. TODO We should renamed this later
|
||||
if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire);
|
||||
//if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire);
|
||||
$newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire);
|
||||
}
|
||||
@ -720,7 +720,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire);
|
||||
if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("StatusOrderBilled"), 2, $user->rights->fournisseur->commande->lire);
|
||||
// Billed is another field. We should add instead a dedicated filter on list. if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("StatusOrderBilled"), 2, $user->rights->fournisseur->commande->lire);
|
||||
|
||||
|
||||
$newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
|
||||
|
||||
@ -29,7 +29,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("sendings");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedShippings'));
|
||||
print load_fiche_titre($langs->trans('RelatedShippings'), '', '');
|
||||
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
|
||||
@ -26,7 +26,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("interventions");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedInterventions'));
|
||||
print load_fiche_titre($langs->trans('RelatedInterventions'), '', '');
|
||||
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
|
||||
@ -63,6 +63,9 @@ class CommandeFournisseur extends CommonOrder
|
||||
// -> 7=Canceled/Never received -> (reopen) 3=Process runing
|
||||
// -> 6=Canceled -> (reopen) 2=Approved
|
||||
// -> 9=Refused -> (reopen) 1=Validated
|
||||
// Note: billed or not is on another field "billed"
|
||||
var $statuts; // List of status
|
||||
|
||||
var $socid;
|
||||
var $fourn_id;
|
||||
var $date;
|
||||
@ -138,7 +141,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->statuts[5] = 'StatusOrderReceivedAll';
|
||||
$this->statuts[6] = 'StatusOrderCanceled'; // Approved->Canceled
|
||||
$this->statuts[7] = 'StatusOrderCanceled'; // Process running->canceled
|
||||
$this->statuts[8] = 'StatusOrderBilled'; // Everything is finish, order received totally and bill received
|
||||
//$this->statuts[8] = 'StatusOrderBilled'; // Everything is finish, order received totally and bill received
|
||||
$this->statuts[9] = 'StatusOrderRefused';
|
||||
}
|
||||
|
||||
@ -510,8 +513,10 @@ class CommandeFournisseur extends CommonOrder
|
||||
global $langs;
|
||||
$langs->load('orders');
|
||||
|
||||
if($statut==5 && $this->billed == 1) $statut = 8;
|
||||
|
||||
$billedtext='';
|
||||
//if ($statut==5 && $this->billed == 1) $statut = 8;
|
||||
if ($this->billed == 1) $billedtext=$langs->trans("Billed");
|
||||
|
||||
// List of language codes for status
|
||||
$statutshort[0] = 'StatusOrderDraftShort';
|
||||
$statutshort[1] = 'StatusOrderValidatedShort';
|
||||
@ -521,7 +526,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$statutshort[5] = 'StatusOrderReceivedAllShort';
|
||||
$statutshort[6] = 'StatusOrderCanceledShort';
|
||||
$statutshort[7] = 'StatusOrderCanceledShort';
|
||||
$statutshort[8] = 'StatusOrderBilledShort';
|
||||
//$statutshort[8] = 'StatusOrderBilledShort';
|
||||
$statutshort[9] = 'StatusOrderRefusedShort';
|
||||
|
||||
if ($mode == 0)
|
||||
@ -550,15 +555,15 @@ class CommandeFournisseur extends CommonOrder
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==4) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==5) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==8) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==9) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==4) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==5) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==6 || $statut==7) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==8) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
if ($statut==9) return img_picto($langs->trans($this->statuts[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]).($billedtext?' - '.$billedtext:'');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
|
||||
@ -196,7 +196,7 @@ if (empty($reshook))
|
||||
|
||||
if ($action == 'reopen') // no test on permission here, permission to use will depends on status
|
||||
{
|
||||
if (in_array($object->statut, array(1, 2, 3, 5, 6, 7, 9)))
|
||||
if (in_array($object->statut, array(1, 2, 3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed))
|
||||
{
|
||||
if ($object->statut == 1) $newstatus=0; // Validated->Draft
|
||||
else if ($object->statut == 2) $newstatus=0; // Approved->Draft
|
||||
@ -205,13 +205,20 @@ if (empty($reshook))
|
||||
else if ($object->statut == 6) $newstatus=2; // Canceled->Approved
|
||||
else if ($object->statut == 7) $newstatus=3; // Canceled->Process running
|
||||
else if ($object->statut == 9) $newstatus=1; // Refused->Validated
|
||||
|
||||
else $newstatus = 2;
|
||||
|
||||
$db->begin();
|
||||
|
||||
$result = $object->setStatus($user, $newstatus);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($newstatus == 0)
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
||||
$sql.= ' SET billed = 0';
|
||||
$sql.= ' WHERE rowid = '.$object->id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($newstatus == 0)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
||||
$sql.= ' SET fk_user_approve = null, fk_user_approve2 = null, date_approve = null, date_approve2 = null';
|
||||
@ -719,6 +726,14 @@ if (empty($reshook))
|
||||
if ($result > 0)
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
$action = '';
|
||||
@ -780,6 +795,7 @@ if (empty($reshook))
|
||||
$result = $object->Livraison($user, $date_liv, GETPOST("type"), GETPOST("comment"));
|
||||
if ($result > 0)
|
||||
{
|
||||
$langs->load("deliveries");
|
||||
setEventMessages($langs->trans("DeliveryStateSaved"), null);
|
||||
$action = '';
|
||||
}
|
||||
@ -2725,7 +2741,7 @@ elseif (! empty($object->id))
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Disapprove").'</a>';
|
||||
}
|
||||
}
|
||||
if (in_array($object->statut, array(3, 5, 6, 7, 9)))
|
||||
if (in_array($object->statut, array(3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed))
|
||||
{
|
||||
if ($user->rights->fournisseur->commande->commander)
|
||||
{
|
||||
|
||||
@ -53,6 +53,8 @@ $socid = GETPOST('socid','int');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
|
||||
$status=GETPOST('statut','alpha');
|
||||
$billed=GETPOST('billed','int');
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Security check
|
||||
@ -70,6 +72,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_ht='';
|
||||
$search_ttc='';
|
||||
$search_status='';
|
||||
$billed='';
|
||||
}
|
||||
|
||||
if ($search_status == '') $search_status=-1;
|
||||
@ -102,11 +105,13 @@ if ($socid > 0)
|
||||
$fourn->fetch($socid);
|
||||
$title .= ' - '.$fourn->name;
|
||||
}
|
||||
if (GETPOST('statut','alpha'))
|
||||
if ($status)
|
||||
{
|
||||
if (GETPOST('statut','alpha') == '1,2,3') $title.=' - '.$langs->trans("StatusOrderToProcessShort");
|
||||
else $title.=' - '.$langs->trans($commandestatic->statuts[GETPOST('statut','alpha')]);
|
||||
if ($status == '1,2,3') $title.=' - '.$langs->trans("StatusOrderToProcessShort");
|
||||
if ($status == '6,7') $title.=' - '.$langs->trans("StatusOrderCanceled");
|
||||
else $title.=' - '.$langs->trans($commandestatic->statuts[$status]);
|
||||
}
|
||||
if ($billed) $title.=' - '.$langs->trans("Billed");
|
||||
|
||||
|
||||
llxHeader('',$title);
|
||||
@ -122,7 +127,7 @@ $offset = $conf->liste_limit * $page ;
|
||||
*/
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,";
|
||||
$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison,";
|
||||
$sql.= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author, cf.date_livraison,";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref,";
|
||||
$sql.= " u.firstname,";
|
||||
$sql.= " u.lastname,";
|
||||
@ -168,9 +173,9 @@ if (GETPOST('statut', 'alpha') !== '')
|
||||
$sql .= " AND cf.fk_statut IN (".GETPOST('statut', 'alpha').")";
|
||||
}
|
||||
|
||||
if (GETPOST('billed', 'int') !== '')
|
||||
if ($billed !== '')
|
||||
{
|
||||
$sql .= " AND cf.billed IN (".GETPOST('billed', 'int').")";
|
||||
$sql .= " AND cf.billed = ".$billed;
|
||||
}
|
||||
|
||||
if ($search_refsupp)
|
||||
@ -209,6 +214,7 @@ if ($resql)
|
||||
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
if ($search_status >= 0) $param.="&search_status=".$search_status;
|
||||
if ($billed != '') $param.="billed=".$billed;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||
@ -238,6 +244,7 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('DateDeliveryPlanned'),$_SERVER["PHP_SELF"],'cf.date_livraison','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('Billed'),$_SERVER["PHP_SELF"],'cf.billed','',$param,'align="center"',$sortfield,$sortorder,'');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -259,6 +266,9 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formorder->selectSupplierOrderStatus((strstr($search_status, ',')?-1:$search_status),1,'search_status');
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print $form->selectyesno('billed', $billed, 1, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><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")).'">';
|
||||
print '<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")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -344,10 +354,12 @@ if ($resql)
|
||||
print dol_print_date($db->jdate($obj->date_livraison), 'day');
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Statut
|
||||
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut, 5).'</td>';
|
||||
|
||||
// Billed
|
||||
print '<td align="center">'.yn($obj->billed).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -29,7 +29,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("orders");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedSupplierOrders'));
|
||||
print load_fiche_titre($langs->trans('RelatedSupplierOrders'), '', '');
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
|
||||
@ -30,7 +30,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("bills");
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans("RelatedSupplierInvoices"));
|
||||
print load_fiche_titre($langs->trans("RelatedSupplierInvoices"), '', '');
|
||||
?>
|
||||
|
||||
<table class="noborder allwidth">
|
||||
|
||||
@ -26,6 +26,10 @@
|
||||
ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 after country;
|
||||
|
||||
|
||||
UPDATE llx_commande_fourn set billed=1 where statut = 8;
|
||||
UPDATE llx_commande_fourn set statut=5 where statut = 8 and billed=1;
|
||||
|
||||
|
||||
ALTER TABLE llx_askpricesupplier RENAME TO llx_supplier_proposal;
|
||||
ALTER TABLE llx_askpricesupplierdet RENAME TO llx_supplier_proposaldet;
|
||||
ALTER TABLE llx_askpricesupplier_extrafields RENAME TO llx_supplier_proposal_extrafields;
|
||||
|
||||
@ -7,6 +7,7 @@ DeliveryOrders=Delivery orders
|
||||
DeliveryDate=Delivery date
|
||||
DeliveryDateShort=Deliv. date
|
||||
CreateDeliveryOrder=Generate delivery order
|
||||
DeliveryStateSaved=Delivery state saved
|
||||
QtyDelivered=Qty delivered
|
||||
SetDeliveryDate=Set shipping date
|
||||
ValidateDeliveryReceipt=Validate delivery receipt
|
||||
|
||||
@ -31,6 +31,7 @@ StatusOrderSentShort=In process
|
||||
StatusOrderSent=Shipment in process
|
||||
StatusOrderOnProcessShort=Ordered
|
||||
StatusOrderProcessedShort=Processed
|
||||
StatusOrderDelivered=Delivered
|
||||
StatusOrderToBillShort=Delivered
|
||||
StatusOrderToBill2Short=To bill
|
||||
StatusOrderApprovedShort=Approved
|
||||
|
||||
@ -29,7 +29,7 @@ $langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
echo '<br>';
|
||||
print load_fiche_titre($langs->trans('RelatedSupplierProposal'));
|
||||
print load_fiche_titre($langs->trans('RelatedSupplierProposal'), '', '');
|
||||
?>
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user