Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2013-07-30 17:23:13 +02:00
commit 57ce331833
48 changed files with 1482 additions and 148 deletions

View File

@ -39,7 +39,8 @@ For users:
- New: Add Maghreb regions and departments.
- New: A more responsive desgin for statistic box of home page.
- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode
For translators:
@ -61,17 +62,20 @@ For developers:
- New: Make some changes to allow usage of several alternative $dolibarr_main_url_root variables.
Fix also several bugs with old code.
- Qual: All nowrap properties are now using CSS class nowrap.
- New: Into POST forms, if you can add a parameter DOL_AUTOSET_COOKIE with a vlue that is list name,
separated by a coma, of other POST parameters, Dolibarr will automatically save this parameters
into user cookies.
WARNING: This may create regression for some external modules, but was necessary to make
WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
1) We started to clean hooks code.
If your hook want to modify value of $actions, it's role
of your hook to modify it. Dolibarr hook code will not decide this for your module anymore.
If your action class for hook was returning a string or an array, instead your module must
set $actionclassinstance->results (to return array)
or $actionclassinstance->resprints (to return string)
to return same thing. The return value must be replaced by a "return 0";
If your hook want to modify value of $actions, it's role of your hook to modify it. Dolibarr
hook code will no more decide this for your module. If your action class for hook was returning
a string or an array, instead your module must set $actionclassinstance->results (to return array)
or $actionclassinstance->resprints (to return string) to return same thing. The return value must
be replaced by a "return 0";
Goal is to fix old compatibility code that does not match hook specifications:
http://wiki.dolibarr.org/index.php/Hooks_system
@ -80,7 +84,7 @@ All content added must be tagged by a '<div>' with css class="login_block_elem"
3) Some methods object->addline used a first parameter that was object->id, some not. Of course
this was not a good pratice, since object->id is already known so no need to provide it as
parameter. All methods addline in this case were modified to remove this information.
parameter. All methods addline in this case were modified to remove this parameter.
***** ChangeLog for 3.4 compared to 3.3.* *****

View File

@ -45,10 +45,10 @@ $action = GETPOST('action');
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
// List of supported permanent search area
$searchform=array("MAIN_SEARCHFORM_SOCIETE","MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE","MAIN_SEARCHFORM_ADHERENT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_ADHERENT);
$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"),$langs->trans("Members"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module310Name');
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT);
$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"),$langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')',$langs->trans("Members"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name');
if ($action == 'update')
@ -67,6 +67,7 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT",$_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities

View File

@ -73,6 +73,11 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
}
if($action == 'USE_VIRTUAL_STOCK') {
$db->begin();
$res = dolibarr_set_const($db, "USE_VIRTUAL_STOCK", GETPOST('USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
}
if($action)
{
if (! $res > 0) $error++;
@ -89,6 +94,7 @@ if($action)
}
}
/*
* View
*/
@ -243,6 +249,26 @@ if (! empty($conf->fournisseur->enabled))
print '</table>';
print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockReplenishment")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var = !$var;
print "<tr ".$bc[$var].">";
print '<td width="60%">'.$langs->trans("UseVirtualStock").'</td>';
print '<td width="160" align="right">';
print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"USE_VIRTUAL_STOCK\">";
print $form->selectyesno("USE_VIRTUAL_STOCK",$conf->global->USE_VIRTUAL_STOCK,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print "</td>\n";
print "</tr>\n";
print '</table>';
dol_htmloutput_mesg($mesg);
$db->close();

View File

@ -77,18 +77,23 @@ class box_graph_invoices_permonth extends ModeleBoxes
'sublink'=>'',
'subtext'=>$langs->trans("Filter"),
'subpicto'=>'filter.png',
'subclass'=>'linkobject',
'target'=>'none' // Set '' to get target="_blank"
);
if ($user->rights->facture->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$shownb=(! empty($conf->global->FACTURE_BOX_GRAPH_SHOW_NB));
$showtot=(! isset($conf->global->FACTURE_BOX_GRAPH_SHOW_TOT) || ! empty($conf->global->FACTURE_BOX_GRAPH_SHOW_TOT));
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST('param'.$this->boxcode.'year')?GETPOST('param'.$this->boxcode.'year','int'):$nowarray['year']);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -183,11 +188,17 @@ class box_graph_invoices_permonth extends ModeleBoxes
});
});
</script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" value="'.$endyear.'">';
$stringtoshow.='<a href="'.$_SERVER["PHP_SELF"].'?action='.$refreshaction.'">';
$stringtoshow.=img_picto($langs->trans("Refresh"),'refresh.png');
$stringtoshow.='</a>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
$stringtoshow.='</form>';
$stringtoshow.='</div>';
if ($shownb && $showtot)
{

View File

@ -76,18 +76,23 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
'sublink'=>'',
'subtext'=>$langs->trans("Filter"),
'subpicto'=>'filter.png',
'subclass'=>'linkobject',
'target'=>'none' // Set '' to get target="_blank"
);
if ($user->rights->fournisseur->facture->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$shownb=(! empty($conf->global->FACTURE_BOX_GRAPH_SHOW_NB));
$showtot=(! isset($conf->global->FACTURE_BOX_GRAPH_SHOW_TOT) || ! empty($conf->global->FACTURE_BOX_GRAPH_SHOW_TOT));
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST('param'.$this->boxcode.'year')?GETPOST('param'.$this->boxcode.'year','int'):$nowarray['year']);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
$startyear=$endyear-1;
$mode='supplier';
$userid=0;
@ -182,11 +187,17 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
});
});
</script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" value="'.$endyear.'">';
$stringtoshow.='<a href="'.$_SERVER["PHP_SELF"].'?action='.$refreshaction.'">';
$stringtoshow.=img_picto($langs->trans("Refresh"),'refresh.png');
$stringtoshow.='</a>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
$stringtoshow.='</form>';
$stringtoshow.='</div>';
if ($shownb && $showtot)
{

View File

@ -77,18 +77,23 @@ class box_graph_orders_permonth extends ModeleBoxes
'sublink'=>'',
'subtext'=>$langs->trans("Filter"),
'subpicto'=>'filter.png',
'subclass'=>'linkobject',
'target'=>'none' // Set '' to get target="_blank"
);
if ($user->rights->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$shownb=(! empty($conf->global->COMMANDE_BOX_GRAPH_SHOW_NB));
$showtot=(! isset($conf->global->COMMANDE_BOX_GRAPH_SHOW_TOT) || ! empty($conf->global->COMMANDE_BOX_GRAPH_SHOW_TOT));
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST('param'.$this->boxcode.'year')?GETPOST('param'.$this->boxcode.'year','int'):$nowarray['year']);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -183,11 +188,17 @@ class box_graph_orders_permonth extends ModeleBoxes
});
});
</script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" value="'.$endyear.'">';
$stringtoshow.='<a href="'.$_SERVER["PHP_SELF"].'?action='.$refreshaction.'">';
$stringtoshow.=img_picto($langs->trans("Refresh"),'refresh.png');
$stringtoshow.='</a>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
$stringtoshow.='</form>';
$stringtoshow.='</div>';
if ($shownb && $showtot)
{

View File

@ -76,18 +76,23 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
'sublink'=>'',
'subtext'=>$langs->trans("Filter"),
'subpicto'=>'filter.png',
'subclass'=>'linkobject',
'target'=>'none' // Set '' to get target="_blank"
);
if ($user->rights->fournisseur->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$shownb=(! empty($conf->global->COMMANDE_BOX_GRAPH_SHOW_NB));
$showtot=(! isset($conf->global->COMMANDE_BOX_GRAPH_SHOW_TOT) || ! empty($conf->global->COMMANDE_BOX_GRAPH_SHOW_TOT));
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST('param'.$this->boxcode.'year')?GETPOST('param'.$this->boxcode.'year','int'):$nowarray['year']);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
$startyear=$endyear-1;
$mode='supplier';
$userid=0;
@ -182,11 +187,17 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
});
});
</script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" value="'.$endyear.'">';
$stringtoshow.='<a href="'.$_SERVER["PHP_SELF"].'?action='.$refreshaction.'">';
$stringtoshow.=img_picto($langs->trans("Refresh"),'refresh.png');
$stringtoshow.='</a>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
$stringtoshow.='</form>';
$stringtoshow.='</div>';
if ($shownb && $showtot)
{

View File

@ -73,22 +73,27 @@ class box_graph_propales_permonth extends ModeleBoxes
$this->info_box_head = array(
'text' => $text,
'limit'=> dol_strlen($text),
'graph'=> 1,
'graph'=> 1, // Set to 1 if it's a box graph
'sublink'=>'',
'subtext'=>$langs->trans("Filter"),
'subpicto'=>'filter.png',
'subclass'=>'linkobject',
'target'=>'none' // Set '' to get target="_blank"
);
if ($user->rights->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
$shownb=(! empty($conf->global->PROPAL_BOX_GRAPH_SHOW_NB));
$showtot=(! isset($conf->global->PROPAL_BOX_GRAPH_SHOW_TOT) || ! empty($conf->global->PROPAL_BOX_GRAPH_SHOW_TOT));
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST('param'.$this->boxcode.'year')?GETPOST('param'.$this->boxcode.'year','int'):$nowarray['year']);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -188,11 +193,17 @@ class box_graph_propales_permonth extends ModeleBoxes
});
});
</script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" value="'.$endyear.'">';
$stringtoshow.='<a href="'.$_SERVER["PHP_SELF"].'?action='.$refreshaction.'">';
$stringtoshow.=img_picto($langs->trans("Refresh"),'refresh.png');
$stringtoshow.='</a>';
$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfProposalsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfProposalsByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';
$stringtoshow.='</form>';
$stringtoshow.='</div>';
if ($shownb && $showtot)
{

View File

@ -110,7 +110,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
/**
* Standard method to show a box (usage by boxes not mandatory, a box can still use its own function)
* Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
@ -160,7 +160,7 @@ class ModeleBoxes // Can't be abtract as it is instanciated to build "empty"
}
print ' ';
if (! empty($head['sublink'])) print '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="" id="idsubimg'.$this->boxcode.'"');
if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
if (! empty($head['sublink'])) '</a>';
if ($conf->use_javascript_ajax)
{

View File

@ -916,6 +916,7 @@ abstract class CommonObject
// TODO uniformize field name
$fieldname = 'fk_mode_reglement';
if ($this->element == 'societe') $fieldname = 'mode_reglement';
if (get_class($this) == 'Fournisseur') $fieldname = 'mode_reglement_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
@ -955,6 +956,7 @@ abstract class CommonObject
// TODO uniformize field name
$fieldname = 'fk_cond_reglement';
if ($this->element == 'societe') $fieldname = 'cond_reglement';
if (get_class($this) == 'Fournisseur') $fieldname = 'cond_reglement_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;

View File

@ -1400,7 +1400,7 @@ class Form
$objp->remise = $objp2->remise;
$objp->price_by_qty_rowid = $objp2->rowid;
$this->constructProductListOption($objp, $opt, $optJson, 0, $selected);
$this->_construct_product_list_option($objp, $opt, $optJson, 0, $selected);
$j++;
@ -1414,7 +1414,7 @@ class Form
}
else
{
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected);
$this->_construct_product_list_option($objp, $opt, $optJson, $price_level, $selected);
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
@ -1870,6 +1870,10 @@ class Form
$objp = $this->db->fetch_object($result);
$opt = '<option value="'.$objp->idprodfournprice.'"';
//if there is only one supplier, preselect it
if($num == 1) {
$opt .= ' selected="selected"';
}
$opt.= '>'.$objp->nom.' - '.$objp->ref_fourn.' - ';
if ($objp->quantity == 1)

View File

@ -171,8 +171,8 @@ function dol_shutdown()
*
* @param string $paramname Name of parameter to found
* @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's alpha only, 'array'=check it's array)
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
* @return string Value found or '' if check fails
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @return string Value found, or '' if check fails
*/
function GETPOST($paramname,$check='',$method=0)
{
@ -180,16 +180,13 @@ function GETPOST($paramname,$check='',$method=0)
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
else return 'BadParameter';
elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:''));
else return 'BadThirdParameterForGETPOST';
if (! empty($check))
{
// Check if numeric
if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',$out))
{
$out=trim($out);
$out='';
}
if ($check == 'int' && ! is_numeric($out)) $out='';
// Check if alpha
elseif ($check == 'alpha')
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1005,6 +1006,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire);
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire);
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire);
}
// Expeditions

View File

@ -7,6 +7,7 @@
* Copyright (C) 2010-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -921,6 +922,10 @@ class CommandeFournisseur extends CommonOrder
$error=0;
$now=dol_now();
if(!$this->source)
{
$this->source = 0;
}
/* On positionne en mode brouillon la commande */
$this->brouillon = 1;
@ -938,7 +943,8 @@ class CommandeFournisseur extends CommonOrder
$sql.= ", fk_statut";
$sql.= ", source";
$sql.= ", model_pdf";
//$sql.= ", fk_mode_reglement";
$sql.= ", fk_mode_reglement";
$sql.= ", fk_cond_reglement";
$sql.= ") ";
$sql.= " VALUES (";
$sql.= "''";
@ -951,9 +957,10 @@ class CommandeFournisseur extends CommonOrder
//$sql.= ", ".$this->db->idate($now);
$sql.= ", ".$user->id;
$sql.= ", 0";
$sql.= ", 0";
$sql.= ", " . $this->source;
$sql.= ", '".$conf->global->COMMANDE_SUPPLIER_ADDON_PDF."'";
//$sql.= ", ".$this->mode_reglement_id;
$sql.= ", ".$this->mode_reglement_id;
$sql.= ", ".$this->cond_reglement_id;
$sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql);

View File

@ -76,6 +76,10 @@ class FactureFournisseur extends CommonInvoice
var $note_private;
var $note_public;
var $propalid;
var $cond_reglement_id;
var $cond_reglement_code;
var $mode_reglement_id;
var $mode_reglement_code;
var $lines;
var $fournisseur; // deprecated
@ -143,6 +147,8 @@ class FactureFournisseur extends CommonInvoice
$sql.= ", datec";
$sql.= ", datef";
$sql.= ", fk_projet";
$sql.= ", fk_cond_reglement";
$sql.= ", fk_mode_reglement";
$sql.= ", note_private";
$sql.= ", note_public";
$sql.= ", fk_user_author";
@ -157,6 +163,8 @@ class FactureFournisseur extends CommonInvoice
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", '".$this->db->idate($this->date)."'";
$sql.= ", ".(isset($this->fk_project)?$this->fk_project:"null");
$sql.= ", ".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null");
$sql.= ", ".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null");
$sql.= ", '".$this->db->escape($this->note_private)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'";
$sql.= ", ".$user->id.",";
@ -300,17 +308,22 @@ class FactureFournisseur extends CommonInvoice
$sql.= " t.fk_facture_source,";
$sql.= " t.fk_projet,";
$sql.= " t.fk_cond_reglement,";
$sql.= " t.fk_mode_reglement,";
$sql.= " t.date_lim_reglement,";
$sql.= " t.note_private,";
$sql.= " t.note_public,";
$sql.= " t.model_pdf,";
$sql.= " t.import_key,";
$sql.= " t.extraparams,";
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
$sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,";
$sql.= ' s.nom as socnom, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (t.fk_cond_reglement = cr.rowid)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (t.fk_mode_reglement = p.id)";
if ($id) $sql.= " WHERE t.rowid=".$id;
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'";
$sql.= ' AND t.fk_soc = s.rowid';
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
@ -352,7 +365,13 @@ class FactureFournisseur extends CommonInvoice
$this->fk_user_valid = $obj->fk_user_valid;
$this->fk_facture_source = $obj->fk_facture_source;
$this->fk_project = $obj->fk_projet;
$this->fk_cond_reglement = $obj->fk_cond_reglement;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle;
$this->date_echeance = $this->db->jdate($obj->date_lim_reglement);
$this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private;

View File

@ -687,6 +687,8 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
// Creation commande
$object->ref_supplier = GETPOST('refsupplier');
$object->socid = $socid;
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
@ -980,6 +982,9 @@ if ($action=="create")
$societe=new Societe($db);
$societe->fetch($socid);
}
$cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1009,6 +1014,16 @@ if ($action=="create")
print '</tr>';
print '</td></tr>';
// Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
$form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
print '</td></tr>';
// Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
print '</td></tr>';
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';

View File

@ -192,6 +192,18 @@ if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
if ($result < 0) dol_print_error($db, $object->error);
}
// conditions de reglement
if ($action == 'setconditions' && $user->rights->fournisseur->commande->creer)
{
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
}
// mode de reglement
else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
{
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
}
// Set label
elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
@ -201,7 +213,6 @@ elseif ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
$result=$object->update($user);
if ($result < 0) dol_print_error($db);
}
elseif ($action == 'setdatef' && $user->rights->fournisseur->facture->creer)
{
$object->fetch($id);
@ -293,6 +304,8 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
$object->date_echeance = $datedue;
$object->note_public = GETPOST('note_public');
$object->note_private = GETPOST('note_private');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
// If creation from another object of another module
@ -1025,9 +1038,9 @@ if ($action == 'create')
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
//$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
$soc = $objectsrc->client;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_supplier_id)?$soc->cond_reglement_supplier_id:1));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
@ -1040,6 +1053,8 @@ if ($action == 'create')
}
else
{
$cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id;
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
@ -1170,6 +1185,16 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans('DateMaxPayment').'</td><td>';
$form->select_date($datedue,'ech','','','',"add",1,1);
print '</td></tr>';
// Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
$form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
print '</td></tr>';
// Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
print '</td></tr>';
// Project
if (! empty($conf->projet->enabled))
@ -1585,6 +1610,47 @@ else
if ($action != 'editdate_lim_reglement' && $object->statut < 2 && $object->date_echeance && $object->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_warning($langs->trans('Late'));
print '</td>';
// Conditions de reglement par defaut
$langs->load('bills');
$form = new Form($db);
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentConditions');
print '<td>';
if ($action != 'editconditions') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editconditions')
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id,'cond_reglement_id');
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id,'none');
}
print "</td>";
print '</tr>';
// Mode of payment
$langs->load('bills');
$form = new Form($db);
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editmode')
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
}
else
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
}
print '</td></tr>';
// Status
$alreadypaid=$object->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4,$alreadypaid).'</td></tr>';

View File

@ -63,7 +63,20 @@ if ($action == 'setsupplieraccountancycode')
}
$action="";
}
// conditions de reglement
if ($action == 'setconditions' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_supplier_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
// mode de reglement
if ($action == 'setmode' && $user->rights->societe->creer)
{
$object->fetch($id);
$result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
if ($result < 0) dol_print_error($db,$object->error);
}
/*
@ -90,7 +103,7 @@ if ($object->fetch($id))
//print '<tr><td valign="top" width="50%" class="notopnoleft">';
print '<table width="100%" class="border">';
print '<tr><td width="20%">'.$langs->trans("ThirdPartyName").'</td><td width="80%" colspan="3">';
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
$object->next_prev_filter="te.fournisseur = 1";
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>';
@ -193,6 +206,46 @@ if ($object->fetch($id))
print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td colspan="3">';
print $object->tva_intra;
print '</td></tr>';
// Conditions de reglement par defaut
$langs->load('bills');
$form = new Form($db);
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('PaymentConditions');
print '<td>';
if (($action != 'editconditions') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editconditions')
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'cond_reglement_supplier_id',-1,1);
}
else
{
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'none');
}
print "</td>";
print '</tr>';
// Mode de reglement par defaut
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
print '<td>';
if (($action != 'editmode') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editmode')
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'mode_reglement_supplier_id');
}
else
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'none');
}
print "</td>";
print '</tr>';
// Module Adherent
if (! empty($conf->adherent->enabled))

View File

@ -31,6 +31,8 @@ create table llx_fichinter_extrafields
) ENGINE=innodb;
ALTER TABLE llx_fichinter_extrafields ADD INDEX idx_ficheinter_extrafields (fk_object);
ALTER TABLE llx_product ADD COLUMN desiredstock integer DEFAULT 0;
create table llx_commandedet_extrafields
(
@ -280,3 +282,8 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
ALTER TABLE llx_bordereau_cheque ADD ref_ext VARCHAR(255);
ALTER TABLE llx_bordereau_cheque ADD tms timestamp;
-- Task 1011
ALTER TABLE `llx_societe` ADD `mode_reglement_supplier` TINYINT NOT NULL AFTER `cond_reglement` ,
ADD `cond_reglement_supplier` TINYINT NOT NULL AFTER `mode_reglement_supplier`;
ALTER TABLE `llx_facture_fourn` ADD `fk_mode_reglement` TINYINT NOT NULL AFTER `fk_cond_reglement`;

View File

@ -59,6 +59,7 @@ create table llx_facture_fourn
fk_projet integer, -- projet auquel est associee la facture
fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...)
fk_mode_reglement integer DEFAULT 0 NOT NULL, -- mode de reglement (CHQ, VIR, ...)
date_lim_reglement date, -- date limite de reglement
note_private text,

View File

@ -3,6 +3,7 @@
-- Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
-- Copyright (C) 2010 juanjo Menent <jmenent@2byte.es>
-- Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@ -70,5 +71,6 @@ create table llx_product
canvas varchar(32) DEFAULT NULL,
finished tinyint DEFAULT NULL,
hidden tinyint DEFAULT 0, -- Need permission see also hidden products
import_key varchar(14) -- Import key
import_key varchar(14), -- Import key
desiredstock integer DEFAULT 0
)ENGINE=innodb;

View File

@ -77,6 +77,8 @@ create table llx_societe
remise_client real DEFAULT 0, -- remise systematique pour le client
mode_reglement tinyint, -- mode de reglement
cond_reglement tinyint, -- condition de reglement
mode_reglement_supplier tinyint, -- mode de reglement fournisseur
cond_reglement_supplier tinyint, -- condition de reglement fournisseur
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2

View File

@ -160,4 +160,9 @@ OrderByPhone=Phone
CreateInvoiceForThisCustomer=Bill orders
NoOrdersToInvoice=No orders billable
CloseProcessedOrdersAutomatically=Classify "Processed" all selected orders.
MenuOrdersToBill2=Billables orders
MenuOrdersToBill2=Billables orders
OrderCreation=Order creation
Ordered=Ordered
OrderCreated=Your orders have been created
OrderFail=An error happened during your orders creation
CreateOrders=Create orders

View File

@ -64,7 +64,6 @@ StockLimitShort=Limit
StockLimit=Stock limit for alerts
PhysicalStock=Physical stock
RealStock=Real Stock
TheoreticalStock=Therocial stock
VirtualStock=Virtual stock
MininumStock=Minimum stock
StockUp=Stock up
@ -88,4 +87,11 @@ ThisWarehouseIsPersonalStock=This warehouse represents personal stock of %s %s
SelectWarehouseForStockDecrease=Choose warehouse to use for stock decrease
SelectWarehouseForStockIncrease=Choose warehouse to use for stock increase
NoStockAction=No stock action
LastWaitingSupplierOrders=Orders waiting for receptions
LastWaitingSupplierOrders=Orders waiting for receptions
DesiredStock=Desired stock
StockToBuy=To order
Replenishment=Replenishment
ReplenishmentOrders=Replenishment orders
UseVirtualStock=Use virtual stock instead of physical stock
RuleForStockReplenishment=Rule for stocks replenishment
SelectProduct=Select at least one product

View File

@ -1456,7 +1456,7 @@ TestGeoIPResult=Test de conversion IP -> Pays
ProjectsNumberingModules=Modèles de numérotation des références projets
ProjectsSetup=Configuration du module Projets
ProjectsModelModule=Modèles de document de rapport projets
TasksNumberingModules==Modèles de numérotation des références taches
TasksNumberingModules=Modèles de numérotation des références taches
TaskModelModule=Modèles de document de rapport taches
##### ECM (GED) #####
ECMSetup = Configuration du module GED

View File

@ -161,3 +161,8 @@ CreateInvoiceForThisCustomer=Facturer commandes
NoOrdersToInvoice=Pas de commandes facturables
CloseProcessedOrdersAutomatically=Classer automatiquement à "Traitées" les commandes sélectionnées.
MenuOrdersToBill2=Commandes à facturer
OrderCreation=Date de création
Ordered=Commandé
OrderCreated=Vos commandes ont été générées
OrderFail=Une erreur s'est produite pendant la création de vos commandes
CreateOrders=Créer commandes

View File

@ -64,7 +64,6 @@ StockLimitShort=Seuil
StockLimit=Seuil d'alerte de stock
PhysicalStock=Stock physique
RealStock=Stock réel
TheoreticalStock=Stock théorique
VirtualStock=Stock théorique
MininumStock=Stock minimum
StockUp=Stock maximum
@ -89,3 +88,10 @@ SelectWarehouseForStockDecrease=Sélectionner l'entrepôt à utiliser pour la d
SelectWarehouseForStockIncrease=Sélectionner l'entrepôt à utiliser pour l'incrémentation du stock
NoStockAction=Pas d'action sur l'entrepôt
LastWaitingSupplierOrders=Commandes en attente de réception
DesiredStock=Stock désiré
StockToBuy=À commander
Replenishment=Réapprovisionnement
ReplenishmentOrders=Commandes de réapprovisionnement
UseVirtualStock=Utiliser le stock théorique à la place du stock physique
RuleForStockReplenishment=Règle de gestion du réapprovisionnement des stocks
SelectProduct=Sélectionnez au moins un produit

View File

@ -162,10 +162,17 @@ if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT
// Include the conf.php and functions.lib.php
require_once 'filefunc.inc.php';
/*var_dump("Define dolgetprefix ".$_SERVER["SERVER_NAME"]." - ".$_SERVER["DOCUMENT_ROOT"]." - ".DOL_DOCUMENT_ROOT." - ".DOL_URL_ROOT);
var_dump("Cookie ".join($_COOKIE,','));
var_dump("Cookie ".$_SERVER["HTTP_COOKIE"]);
var_dump("Cookie ".$_SERVER["HTTP_USER_AGENT"]);*/
// If there is a POST parameter to tell to save automatically some POST params into a cookies, we do it
if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
{
$tmplist=explode(',',$_POST["DOL_AUTOSET_COOKIE"]);
foreach ($tmplist as $value)
{
//var_dump('setcookie key='.$value.' value='.$_POST[$value]);
setcookie($value, empty($_POST[$value])?'':$_POST[$value], empty($_POST[$value])?0:(time()+(86400*354)), '/'); // keep cookie 1 year
if (empty($_POST[$value])) unset($_COOKIE[$value]);
}
}
// Init session. Name of session is specific to Dolibarr instance.
$prefix=dol_getprefix();
@ -1533,8 +1540,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled)
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/liste.php', DOL_URL_ROOT.'/fourn/product/liste.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier');

View File

@ -83,7 +83,8 @@ class Product extends CommonObject
var $pmp;
//! Stock alert
var $seuil_stock_alerte;
//! Ask for replenishment when $desiredstock < $stock_reel
public $desiredstock;
//! Duree de validite du service
var $duration_value;
//! Unite de duree
@ -165,6 +166,7 @@ class Product extends CommonObject
$this->nbphoto = 0;
$this->stock_reel = 0;
$this->seuil_stock_alerte = 0;
$this->desiredstock = 0;
$this->canvas = '';
}
@ -489,6 +491,7 @@ class Product extends CommonObject
$sql.= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
$sql.= ",accountancy_code_buy = '" . $this->accountancy_code_buy."'";
$sql.= ",accountancy_code_sell= '" . $this->accountancy_code_sell."'";
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
$sql.= " WHERE rowid = " . $id;
dol_syslog(get_class($this)."update sql=".$sql);
@ -1135,7 +1138,7 @@ class Product extends CommonObject
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,";
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
$sql.= " datec, tms, import_key, entity";
$sql.= " datec, tms, import_key, entity, desiredstock";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
if ($id) $sql.= " WHERE rowid = '".$id."'";
else
@ -1199,6 +1202,7 @@ class Product extends CommonObject
$this->accountancy_code_sell = $obj->accountancy_code_sell;
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
$this->desiredstock = $obj->desiredstock;
$this->stock_reel = $obj->stock;
$this->pmp = $obj->pmp;
@ -2199,7 +2203,8 @@ class Product extends CommonObject
'stock'=>$this->stock_warehouse[1]->real, // Stock
'stock_alert'=>$this->seuil_stock_alerte, // Stock alert
'fullpath' => $compl_path.$label, // Label
'type'=>$type // Nb of units that compose parent product
'type'=>$type, // Nb of units that compose parent product
'desiredstock' => $this->desiredstock
);
// Recursive call if child is an array

View File

@ -7,6 +7,7 @@
* Copyright (C) 2006 Auguria SARL <info@auguria.org>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -187,6 +188,7 @@ if (empty($reshook))
$object->duration_value = GETPOST('duration_value');
$object->duration_unit = GETPOST('duration_unit');
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0;
$object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0;
$object->canvas = GETPOST('canvas');
$object->weight = GETPOST('weight');
$object->weight_units = GETPOST('weight_units');
@ -256,6 +258,7 @@ if (empty($reshook))
$object->status = GETPOST('statut');
$object->status_buy = GETPOST('statut_buy');
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$object->desiredstock = GETPOST('desiredstock');
$object->duration_value = GETPOST('duration_value');
$object->duration_unit = GETPOST('duration_unit');
$object->canvas = GETPOST('canvas');
@ -723,12 +726,17 @@ else
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
print '<input name="seuil_stock_alerte" size="4" value="'.GETPOST('seuil_stock_alerte').'">';
print '</td></tr>';
// Stock desired level
print '<tr><td>'.$langs->trans("DesiredStock").'</td><td>';
print '<input name="desiredstock" size="4" value="'.GETPOST('desiredstock').'">';
print '</td></tr>';
}
else
{
print '<input name="seuil_stock_alerte" type="hidden" value="0">';
print '<input name="desiredstock" type="hidden" value="0">';
}
// Description (used in invoice, propal...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
@ -934,10 +942,15 @@ else
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td colspan="2">';
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
print '</td></tr>';
print "<tr>".'<td>'.$langs->trans("DesiredStock").'</td><td colspan="2">';
print '<input name="desiredstock" size="4" value="'.$object->desiredstock.'">';
print '</td></tr>';
}
else
{
print '<input name="seuil_stock_alerte" type="hidden" value="'.$object->seuil_stock_alerte.'">';
print '<input name="desiredstock" type="hidden" value="'.$object->desiredstock.'">';
}
if ($object->isservice())

View File

@ -6,6 +6,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -130,6 +131,7 @@ else
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
$sql.= ' MIN(pfp.unitprice) as minsellprice';
$sql .= ', p.desiredstock';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
@ -195,6 +197,7 @@ else
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.tms,";
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
$sql .= ', p.desiredstock';
//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
@ -301,6 +304,7 @@ else
if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre" align="right">'.$langs->trans("BuyingPriceMinShort").'</td>';
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("DesiredStock").'</td>';
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print '<td class="liste_titre" align="right">'.$langs->trans("PhysicalStock").'</td>';
print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
@ -351,6 +355,10 @@ else
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
//desiredstock
print '<td class="liste_titre">';
print '&nbsp;';
print '</td>';
}
print '<td class="liste_titre">';
@ -457,6 +465,9 @@ else
{
$product_static->id = $objp->rowid;
$product_static->load_stock();
print '<td align="right">';
print $objp->desiredstock;
print '</td>';
print '<td align="right">';
if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
print $product_static->stock_reel;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -104,6 +105,7 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte,';
$sql.= ' SUM(s.reel) as stock_physique';
$sql .= ', p.desiredstock';
$sql.= ' FROM ('.MAIN_DB_PREFIX.'product as p';
// We'll need this table joined to the select in order to filter by categ
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
@ -157,6 +159,7 @@ if ($search_categ)
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.tms,";
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
$sql .= ", p.desiredstock";
if ($toolowstock) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset);
@ -242,6 +245,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label",$param,"","",$sortfield,$sortorder);
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DesiredStock"),"reassort.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
// TODO Add info of running suppliers/customers orders
//print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);
@ -267,7 +271,8 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
@ -319,6 +324,7 @@ if ($resql)
}
//print '<td align="right">'.$objp->stock_theorique.'</td>';
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
print '<td align="right">'.$objp->desiredstock.'</td>';
print '<td align="right">';
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
print $objp->stock_physique;
@ -356,4 +362,4 @@ else
llxFooter();
$db->close();
?>
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

View File

@ -0,0 +1,123 @@
<?php
/*
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/product/stock/replenishment.lib.php
* \ingroup produit
* \brief Contains functions used in replenish.php and replenishorders.php
*/
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
function dispatched($order_id)
{
global $db;
$sql = 'SELECT fk_product, SUM(qty) from llx_commande_fournisseur_dispatch';
$sql .= ' WHERE fk_commande = ' . $order_id . ' GROUP BY fk_product';
$sql .= ' ORDER by fk_product';
$resql = $db->query($sql);
$dispatched = array();
$ordered = array();
if($resql && $db->num_rows($resql)) {
while($res = $db->fetch_object($resql))
$dispatched[] = $res;
}
$sql = 'SELECT fk_product, SUM(qty) from llx_commande_fournisseurdet';
$sql .= ' WHERE fk_commande = ' . $order_id . ' GROUP BY fk_product';
$sql .= ' ORDER by fk_product';
$resql = $db->query($sql);
if($resql && $db->num_rows($resql)) {
while($res = $db->fetch_object($resql))
$ordered[] = $res;
}
return $dispatched == $ordered;
}
function dispatchedOrders()
{
global $db;
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur';
$resql = $db->query($sql);
$res = array();
if ($resql && $db->num_rows($resql) > 0) {
while ($obj = $db->fetch_object($resql)) {
if (dispatched($obj->rowid)) {
$res[] = $obj->rowid;
}
}
}
if ($res) {
$res = '(' . implode(',', $res) . ')';
} else {
//hack to make sure ordered SQL request won't syntax error
$res = '(0)';
}
return $res;
}
function ordered($product_id)
{
global $db, $langs, $conf;
$sql = 'SELECT DISTINCT cfd.fk_product, SUM(cfd.qty) FROM';
$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseurdet as cfd ';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
$sql .= ' ON cfd.fk_commande = cf.rowid WHERE';
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
$sql .= ' cf.fk_statut < 3';
} else if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) {
$sql .= ' cf.fk_statut < 6 AND cf.rowid NOT IN ' . dispatchedOrders();
} else {
$sql .= ' cf.fk_statut < 5';
}
$sql .= ' AND cfd.fk_product = ' . $product_id;
$sql .= ' GROUP BY cfd.fk_product';
$resql = $db->query($sql);
if ($resql) {
$exists = $db->num_rows($resql);
if ($exists) {
$obj = $db->fetch_array($resql);
return $obj['SUM(cfd.qty)']; //. ' ' . img_picto('','tick');
} else {
return null;//img_picto('', 'stcomm-1');
}
} else {
$error = $db->lasterror();
dol_print_error($db);
dol_syslog('replenish.php: ' . $error, LOG_ERROR);
return $langs->trans('error');
}
}
function getProducts($order_id)
{
global $db;
$order = new CommandeFournisseur($db);
$f = $order->fetch($order_id);
$products = array();
if($f) {
foreach($order->lines as $line) {
if (!in_array($line->fk_product, $products)) {
$products[] = $line->fk_product;
}
}
}
return $products;
}
?>

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador.gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,6 +44,7 @@ $cancel=GETPOST('cancel');
$id = GETPOST('id')?GETPOST('id'):GETPOST('ref');
$ref = GETPOST('ref');
$stocklimit = GETPOST('stocklimit');
$desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel');
$fieldid = isset($_GET["ref"])?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
@ -67,6 +69,19 @@ if ($action == 'setstocklimit')
$action='';
}
// Set desired stock
if ($action == 'setdesiredstock')
{
$product = new Product($db);
$result=$product->fetch($id);
$product->desiredstock=$desiredstock;
$result=$product->update($product->id,$user,1,0,1);
if ($result < 0)
setEventMessage($product->error, 'errors');
$action='';
}
// Correct stock
if ($action == "correct_stock" && ! $cancel)
{
@ -247,6 +262,11 @@ if ($id > 0 || $ref)
print '<tr><td>'.$form->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer).'</td><td colspan="2">';
print $form->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer);
print '</td></tr>';
// Desired stock
print '<tr><td>'.$form->editfieldkey("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer).'</td><td colspan="2">';
print $form->editfieldval("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer);
print '</td></tr>';
// Real stock
$product->load_stock();

View File

@ -0,0 +1,541 @@
<?php
/*
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/product/stock/replenish.php
* \ingroup produit
* \brief Page to list stocks to replenish
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once './lib/replenishment.lib.php';
$langs->load("products");
$langs->load("stocks");
$langs->load("orders");
// Security check
if ($user->societe_id) {
$socid = $user->societe_id;
}
$result=restrictedArea($user,'produit|service');
//checks if a product has been ordered
$action = GETPOST('action','alpha');
$sref = GETPOST('sref', 'alpha');
$snom = GETPOST('snom', 'alpha');
$sall = GETPOST('sall', 'alpha');
$type = GETPOST('type','int');
$tobuy = GETPOST('tobuy', 'int');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (!$sortfield) {
$sortfield = 'p.ref';
}
if (!$sortorder) {
$sortorder = 'ASC';
}
$limit = $conf->liste_limit;
$offset = $limit * $page ;
/*
* Actions
*/
//orders creation
//FIXME: could go in the lib
if ($action == 'order') {
$linecount = GETPOST('linecount', 'int');
$box = 0;
unset($_POST['linecount']);
if ($linecount > 0) {
$suppliers = array();
for ($i = 0; $i < $linecount; $i++) {
if(GETPOST($i, 'alpha') === 'on'
&& GETPOST('fourn' . $i, 'int') > 0) { //one line
$box = $i;
$supplierpriceid = GETPOST('fourn'.$i, 'int');
//get all the parameters needed to create a line
$qty = GETPOST('tobuy'.$i, 'int');
$desc = GETPOST('desc'.$i, 'alpha');
$sql = 'SELECT fk_product, fk_soc, ref_fourn';
$sql .= ', tva_tx, unitprice FROM ';
$sql .= MAIN_DB_PREFIX . 'product_fournisseur_price';
$sql .= ' WHERE rowid = ' . $supplierpriceid;
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
//might need some value checks
$obj = $db->fetch_object($resql);
$line = new CommandeFournisseurLigne($db);
$line->qty = $qty;
$line->desc = $desc;
$line->fk_product = $obj->fk_product;
$line->tva_tx = $obj->tva_tx;
$line->subprice = $obj->unitprice;
$line->total_ht = $obj->unitprice * $qty;
$tva = $line->tva_tx / 100;
$line->total_tva = $line->total_ht * $tva;
$line->total_ttc = $line->total_ht + $line->total_tva;
$line->ref_fourn = $obj->ref_fourn;
$suppliers[$obj->fk_soc]['lines'][] = $line;
} else {
$error=$db->lasterror();
dol_print_error($db);
dol_syslog('replenish.php: '.$error, LOG_ERROR);
}
$db->free($resql);
unset($_POST['fourn' . $i]);
}
unset($_POST[$i]);
}
//we now know how many orders we need and what lines they have
$i = 0;
$orders = array();
$suppliersid = array_keys($suppliers);
foreach ($suppliers as $supplier) {
$order = new CommandeFournisseur($db);
$order->socid = $suppliersid[$i];
//trick to know which orders have been generated this way
$order->source = 42;
foreach ($supplier['lines'] as $line) {
$order->lines[] = $line;
}
$id = $order->create($user);
if ($id < 0) {
$fail++;
setEventMessage($langs->trans('OrderFail'), 'errors');
}
$i++;
}
if (!$fail && $id) {
setEventMessage($langs->trans('OrderCreated'), 'mesgs');
header('Location: replenishorders.php');
exit;
}
}
if ($box == 0) {
setEventMessage($langs->trans('SelectProduct'), 'warnings');
}
}
/*
* View
*/
$title = $langs->trans('Status');
$sql = 'SELECT p.rowid, p.ref, p.label, p.price';
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type';
$sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,';
$sql .= ' SUM(s.reel) as stock_physique';
$sql .= ', p.desiredstock';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pf';
$sql .= ' ON p.rowid = pf.fk_product';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
$sql .= ' ON p.rowid = s.fk_product';
$sql.= ' WHERE p.entity IN (' . getEntity("product", 1) . ')';
if ($sall) {
$sql .= ' AND (p.ref LIKE "%'.$db->escape($sall).'%" ';
$sql .= 'OR p.label LIKE "%'.$db->escape($sall).'%" ';
$sql .= 'OR p.description LIKE "%'.$db->escape($sall).'%" ';
$sql .= 'OR p.note LIKE "%'.$db->escape($sall).'%")';
}
// if the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($type)) {
if ($type == 1) {
$sql .= ' AND p.fk_product_type = 1';
} else {
$sql .= ' AND p.fk_product_type != 1';
}
}
if ($sref) {
$sql .= ' AND p.ref LIKE "%' . $sref . '%"';
}
if ($snom) {
$sql .= ' AND p.label LIKE "%' . $db->escape($snom) . '%"';
}
$sql .= ' AND p.tobuy = 1';
if (!empty($canvas)) {
$sql .= ' AND p.canvas = "' . $db->escape($canvas) . '"';
}
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.price';
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
$sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte';
$sql .= ', p.desiredstock';
$sql .= ' HAVING (p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL)';
$sql .= ' AND p.desiredstock > 0';
$sql .= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
if ($num == 1 && ($sall or $snom or $sref)) {
$objp = $db->fetch_object($resql);
header('Location: ../fiche.php?id=' . $objp->rowid);
exit;
}
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
$helpurl .= 'ES:M&oacute;dulo_Stocks';
llxHeader('', $title, $helpurl, $title);
$head = array();
$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
$head[0][1] = $title;
$head[0][2] = 'replenish';
$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
$head[1][1] = $langs->trans("ReplenishmentOrders");
$head[1][2] = 'replenishorders';
dol_fiche_head($head, 'replenish', $langs->trans('Replenishment'), 0, 'stock');
if ($sref || $snom || $sall || GETPOST('search', 'alpha')) {
$filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&amp;sall=' . $sall;
print_barre_liste($texte,
$page,
'replenish.php',
$filters,
$sortfield,
$sortorder,
'',
$num
);
} else {
$filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&fourn_id=' . $fourn_id;
$filters .= (isset($type)?'&amp;type=' . $type:'');
print_barre_liste($texte,
$page,
'replenish.php',
$filters,
$sortfield,
$sortorder,
'',
$num);
}
echo '<form action="replenish.php" method="post" name="formulaire">',
'<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">',
'<input type="hidden" name="sortfield" value="' . $sortfield . '">',
'<input type="hidden" name="sortorder" value="' . $sortorder . '">',
'<input type="hidden" name="type" value="' . $type . '">',
'<input type="hidden" name="linecount" value="' . $num . '">',
'<input type="hidden" name="action" value="order">',
'<table class="liste" width="100%">';
$param = (isset($type)? '&type=' . $type : '');
$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom;
$param .= '&sref=' . $sref;
// Lignes des titres
echo '<tr class="liste_titre">',
'<td><input type="checkbox" onClick="toggle(this)" /></td>';
print_liste_field_titre($langs->trans('Ref'),
'replenish.php',
'p.ref',
$param,
'',
'',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('Label'),
'replenish.php',
'p.label',
$param,
'',
'',
$sortfield,
$sortorder
);
if (!empty($conf->service->enabled) && $type == 1) {
print_liste_field_titre($langs->trans('Duration'),
'replenish.php',
'p.duration',
$param,
'',
'align="center"',
$sortfield,
$sortorder
);
}
print_liste_field_titre($langs->trans('DesiredStock'),
'replenish.php',
'p.desiredstock',
$param,
'',
'align="right"',
$sortfield,
$sortorder
);
if ($conf->global->USE_VIRTUAL_STOCK) {
$stocklabel = $langs->trans('VirtualStock');
} else {
$stocklabel = $langs->trans('PhysicalStock');
}
print_liste_field_titre($stocklabel,
'replenish.php',
'stock_physique',
$param,
'',
'align="right"',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('Ordered'),
'replenish.php',
'',
$param,
'',
'align="right"',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('StockToBuy'),
'replenish.php',
'',
$param,
'',
'align="right"',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('Supplier'),
'replenish.php',
'',
$param,
'',
'align="right"',
$sortfield,
$sortorder
);
echo '<td>&nbsp;</td>',
'</tr>',
// Lignes des champs de filtre
'<tr class="liste_titre">',
'<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre">',
'<input class="flat" type="text" name="sref" value="' . $sref . '">',
'</td>',
'<td class="liste_titre">',
'<input class="flat" type="text" name="snom" value="' . $snom . '">',
'</td>';
if (!empty($conf->service->enabled) && $type == 1) {
echo '<td class="liste_titre">',
'&nbsp;',
'</td>';
}
echo '<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre" align="right">&nbsp;</td>',
'<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre" align="right">',
'<input type="image" class="liste_titre" name="button_search"',
'src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" alt="' . $langs->trans("Search") . '">',
'</td>',
'</tr>';
$prod = new Product($db);
$var = True;
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
if ($conf->global->STOCK_SUPPORTS_SERVICES
|| $objp->fk_product_type == 0) {
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) {
$sql = 'SELECT label';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang';
$sql .= ' WHERE fk_product = ' . $objp->rowid;
$sql .= ' AND lang = "' . $langs->getDefaultLang() . '"';
$sql .= ' LIMIT 1';
$result = $db->query($sql);
if ($result) {
$objtp = $db->fetch_object($result);
if (!empty($objtp->label)) {
$objp->label = $objtp->label;
}
}
}
$form = new Form($db);
$var =! $var;
$prod->ref = $objp->ref;
$prod->id = $objp->rowid;
$prod->type = $objp->fk_product_type;
$ordered = ordered($prod->id);
if (!$objp->stock_physique) {
$objp->stock_physique = 0;
}
if ($conf->global->USE_VIRTUAL_STOCK) {
//compute virtual stock
$prod->fetch($prod->id);
$result=$prod->load_stats_commande(0, '1,2');
if ($result < 0) {
dol_print_error($db, $prod->error);
}
$stock_commande_client = $prod->stats_commande['qty'];
$result=$prod->load_stats_commande_fournisseur(0, '3');
if ($result < 0) {
dol_print_error($db,$prod->error);
}
$stock_commande_fournisseur = $prod->stats_commande_fournisseur['qty'];
$stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur;
} else {
$stock = $objp->stock_physique;
}
$warning='';
if ($objp->seuil_stock_alerte
&& ($stock < $objp->seuil_stock_alerte)) {
$warning = img_warning($langs->trans('StockTooLow')) . ' ';
}
//depending on conf, use either physical stock or
//virtual stock to compute the stock to buy value
$stocktobuy = max($objp->desiredstock - $stock - $ordered, 0);
$disabled = '';
if($ordered > 0) {
if($ordered + $stock >= $objp->desiredstock) {
$picto = img_picto('', './img/yes', '', 1);
$disabled = 'disabled="disabled"';
}
else {
$picto = img_picto('', './img/no', '', 1);
}
} else {
$picto = img_picto('', './img/no', '', 1);
}
echo '<tr ' . $bc[$var] . '>',
'<td><input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td>',
'<td class="nowrap">',
$prod->getNomUrl(1, '', 16),
'</td>',
'<td>' . $objp->label . '</td>',
'<input type="hidden" name="desc' . $i . '" value="' . $objp->label . '" >';
if (!empty($conf->service->enabled) && $type == 1) {
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
$duration = $regs[1] . ' ' . $langs->trans('DurationYear');
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
$duration = $regs[1] . ' ' . $langs->trans('DurationMonth');
} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
$duration = $regs[1] . ' ' . $langs->trans('DurationDay');
} else {
$duration = $objp->duration;
}
echo '<td align="center">',
$duration,
'</td>';
}
echo '<td align="right">' . $objp->desiredstock . '</td>',
'<td align="right">',
$warning, $stock,
'</td>',
'<td align="right">',
'<a href="replenishorders.php?sproduct=' , $prod->id, '">',
$ordered, '</a> ', $picto,
'</td>',
'<td align="right">',
'<input type="text" name="tobuy' . $i .
'" value="' . $stocktobuy . '" ' . $disabled . '>',
'</td>',
'<td align="right">',
$form->select_product_fourn_price($prod->id,
'fourn' . $i,
1
),
'</td>',
'<td>&nbsp</td>',
'</tr>';
}
$i++;
}
$value = $langs->trans("CreateOrders");
echo '</table>',
'</div>',
'<table width="100%">',
'<tr><td align="right">',
'<input class="butAction" type="submit" value="' . $value . '">',
'</td></tr></table>',
'</form>';
if ($num > $conf->liste_limit) {
if ($sref || $snom || $sall || GETPOST('search', 'alpha')) {
$filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&amp;sall=' . $sall;
print_barre_liste('',
$page,
'replenish.php',
$filters,
$sortfield,
$sortorder,
'',
$num,
0,
''
);
} else {
$filters = '&sref=' . $sref . '&snom=' . $snom;
$filters .= '&fourn_id=' . $fourn_id;
$filters .= (isset($type)? '&amp;type=' . $type : '');
print_barre_liste('',
$page,
'replenish.php',
$filters,
$sortfield,
$sortorder,
'',
$num,
0,
''
);
}
}
$db->free($resql);
echo ' <script type="text/javascript">
function toggle(source)
{
checkboxes = document.getElementsByClassName("check");
for (var i=0; i < checkboxes.length;i++) {
if (!checkboxes[i].disabled) {
checkboxes[i].checked = source.checked;
}
}
} </script>';
} else {
dol_print_error($db);
}
llxFooter();
$db->close();

View File

@ -0,0 +1,318 @@
<?php
/*
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/product/stock/replenishorders.php
* \ingroup produit
* \brief Page to list replenishment orders
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once './lib/replenishment.lib.php';
$langs->load("products");
$langs->load("stocks");
$langs->load("orders");
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service');
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|';
$helpurl .= 'ES:M&oacute;dulo_Stocks';
$texte = $langs->trans('ReplenishmentOrders');
llxHeader('', $texte, $helpurl, $texte);
$head = array();
$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
$head[0][1] = $langs->trans('Status');
$head[0][2] = 'replenish';
$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
$head[1][1] = $texte;
$head[1][2] = 'replenishorders';
dol_fiche_head($head,
'replenishorders',
$langs->trans('Replenishment'),
0,
'stock');
$commandestatic = new CommandeFournisseur($db);
$sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'int');
$sall = GETPOST('search_all', 'alpha');
$sdate = GETPOST('search_date', 'alpha');
$page = GETPOST('page', 'int');
$sproduct = GETPOST('sproduct', 'int');
$sortorder = GETPOST('sortorder', 'alpha');
$sortfield = GETPOST('sortfield', 'alpha');
if (!$sortorder) {
$sortorder = 'DESC';
}
if (!$sortfield) {
$sortfield = 'cf.date_creation';
}
$offset = $conf->liste_limit * $page ;
$sql = 'SELECT s.rowid as socid, s.nom, cf.date_creation as dc,';
$sql .= ' cf.rowid, cf.ref, cf.fk_statut, cf.total_ttc';
$sql .= ", cf.fk_user_author, u.login";
$sql .= ' FROM (' . MAIN_DB_PREFIX . 'societe as s,';
$sql .= ' ' . MAIN_DB_PREFIX . 'commande_fournisseur as cf';
if (!$user->rights->societe->client->voir && !$socid) {
$sql.= ', ' . MAIN_DB_PREFIX . 'societe_commerciaux as sc';
}
$sql .= ') LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ';
$sql .= 'ON cf.fk_user_author = u.rowid';
$sql .= ' WHERE cf.fk_soc = s.rowid ';
$sql .= ' AND cf.entity = ' . $conf->entity;
if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
$sql .= ' AND cf.fk_statut < 3';
} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) {
$sql .= ' AND cf.fk_statut < 6';
} else {
$sql .= ' AND cf.fk_statut < 5';
}
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id;
}
if ($sref) {
$sql .= ' AND cf.ref LIKE "%' . $db->escape($sref) . '%"';
}
if ($snom) {
$sql .= ' AND s.nom LIKE "%' . $db->escape($snom) . '%"';
}
if ($suser) {
$sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"';
}
if ($sttc) {
$sql .= ' AND cf.total_ttc = ' . price2num($sttc);
}
if ($sdate) {
if(GETPOST('search_datemonth', 'int') && GETPOST('search_dateday', 'int')
&& GETPOST('search_dateyear', 'int')) {
$date = date('Y-m-d',
dol_mktime(0,
0,
0,
GETPOST('search_datemonth', 'int'),
GETPOST('search_dateday', 'int'),
GETPOST('search_dateyear', 'int')
)
);
} else {
$elts = explode('/', $sdate);
$datearray = array();
if ($elts[2]) {
$datearray[0] = $elts[2];
}
if ($elts[1]) {
$datearray[1] = $elts[1];
}
if ($elts[0]) {
$datearray[2] = $elts[0];
}
$date = implode('-', $datearray);
}
$sql .= ' AND cf.date_creation LIKE "%' . $date . '%"';
}
if ($sall) {
$sql .= ' AND (cf.ref LIKE "%' . $db->escape($sall) . '%" ';
$sql .= 'OR cf.note LIKE "%' . $db->escape($sall) . '%")';
}
if ($socid) {
$sql .= ' AND s.rowid = ' . $socid;
}
if (GETPOST('statut', 'int')) {
$sql .= ' AND fk_statut = ' . GETPOST('statut', 'int');
}
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ';
$sql .= $db->plimit($conf->liste_limit+1, $offset);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans('ReplenishmentOrders'),
$page,
'replenishorders.php',
'',
$sortfield,
$sortorder,
'',
$num
);
echo '<form action="replenishorders.php" method="GET">',
'<table class="noborder" width="100%">',
'<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),
$_SERVER['PHP_SELF'],
'cf.ref',
'',
'',
'',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('Company'),
$_SERVER['PHP_SELF'],
's.nom',
'',
'',
'',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('Author'),
$_SERVER['PHP_SELF'],
'u.login',
'',
'',
'',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('AmountTTC'),
$_SERVER['PHP_SELF'],
'cf.total_ttc',
'',
'',
'',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('OrderCreation'),
$_SERVER['PHP_SELF'],
'cf.date_creation',
'',
'',
'',
$sortfield,
$sortorder
);
print_liste_field_titre($langs->trans('Status'),
$_SERVER['PHP_SELF'],
'cf.fk_statut',
'',
'',
'align="right"',
$sortfield,
$sortorder
);
$form = new Form($db);
echo '</tr>',
'<tr class="liste_titre">',
'<td class="liste_titre">',
'<input type="text" class="flat" name="search_ref" value="' . $sref . '">',
'</td>',
'<td class="liste_titre">',
'<input type="text" class="flat" name="search_nom" value="' . $snom . '">',
'</td>',
'<td class="liste_titre">',
'<input type="text" class="flat" name="search_user" value="' . $suser . '">',
'</td>',
'<td class="liste_titre">',
'<input type="text" class="flat" name="search_ttc" value="' . $sttc . '">',
'</td>',
'<td class="liste_titre">',
$form->select_date('', 'search_date', 0, 0, 1, "", 1, 0, 1, 0, ''),
'</td>',
'<td class="liste_titre" align="right">';
$src = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png';
$value = dol_escape_htmltag($langs->trans('Search'));
echo '<input type="image" class="liste_titre" name="button_search" src="' . $src . '" value="' . $value . '" title="' . $value . '">',
'</td>',
'</tr>';
$var = true;
$userstatic = new User($db);
while ($i < min($num,$conf->liste_limit)) {
$obj = $db->fetch_object($resql);
$var = !$var;
if(!dispatched($obj->rowid) &&
(!$sproduct || in_array($sproduct, getProducts($obj->rowid)))) {
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
echo '<tr ' . $bc[$var] . '>',
// Ref
'<td>',
'<a href="' . $href . '">',
img_object($langs->trans('ShowOrder'), 'order') . ' ' . $obj->ref,
'</a></td>';
// Company
$href = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $obj->socid;
echo '<td>',
'<a href="' . $href .'">',
img_object($langs->trans('ShowCompany'), 'company'), ' ',
$obj->nom . '</a></td>';
// Author
$userstatic->id = $obj->fk_user_author;
$userstatic->login = $obj->login;
if ($userstatic->id) {
$txt = $userstatic->getLoginUrl(1);
} else {
$txt = '&nbsp;';
}
echo '<td>',
$txt,
'</td>',
// Amount
'<td>',
price($obj->total_ttc),
'</td>';
// Date
if ($obj->dc) {
$date = dol_print_date($db->jdate($obj->dc), 'day');
} else {
$date = '-';
}
echo '<td>',
$date,
'</td>',
// Statut
'<td align="right">',
$commandestatic->LibStatut($obj->fk_statut, 5),
'</td>',
'</tr>';
}
$i++;
}
echo '</table>',
'</form>';
$db->free($resql);
}
llxFooter();
$db->close();

View File

@ -106,6 +106,8 @@ class Societe extends CommonObject
var $remise_percent;
var $mode_reglement_id;
var $cond_reglement_id;
var $mode_reglement_supplier_id;
var $cond_reglement_supplier_id;
var $client; // 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
var $prospect; // 0=no prospect, 1=prospect
@ -707,7 +709,7 @@ class Societe extends CommonObject
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
$sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
@ -826,6 +828,8 @@ class Societe extends CommonObject
$this->remise_percent = $obj->remise_client;
$this->mode_reglement_id = $obj->mode_reglement;
$this->cond_reglement_id = $obj->cond_reglement;
$this->mode_reglement_supplier_id = $obj->mode_reglement_supplier;
$this->cond_reglement_supplier_id = $obj->cond_reglement_supplier;
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;

View File

@ -1354,9 +1354,15 @@ tr.box_pair {
font-family:<?php print $fontlist ?>;
}
tr.fiche {
font-family:<?php print $fontlist ?>;
.formboxfilter {
vertical-align: middle;
}
.formboxfilter input[type=image]
{
top: 5px;
position: relative;
}
/*
* Ok, Warning, Error

View File

@ -1521,10 +1521,14 @@ tr.box_pair td, tr.box_impair td, td.box_pair, td.box_impair
/*border-bottom: 1px solid white;*/
}
tr.fiche {
font-family: <?php print $fontlist ?>;
.formboxfilter {
vertical-align: middle;
}
.formboxfilter input[type=image]
{
top: 3px;
position: relative;
}

View File

@ -1648,10 +1648,14 @@ background: #f4f4f4;
font-family: <?php print $fontlist ?>;
}
tr.fiche {
font-family: <?php print $fontlist ?>;
.formboxfilter {
vertical-align: middle;
}
.formboxfilter input[type=image]
{
top: 3px;
position: relative;
}

View File

@ -745,10 +745,10 @@ a.vsmenu:hover { font-size:11px; text-align:left; font-weight: normal; colo
font.vsmenudisabled { font-size:11px; text-align:left; font-weight: normal; color: #202020; }
font.vsmenudisabledmargin { margin: 1px 1px 1px 4px; }
a.help:link { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #68ACCF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:visited { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #68ACCF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:active { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #6198BA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:hover { font-size: 10px; font-weight: bold; background: #FFFFFF; border: 1px solid #8CACBB; color: #6198BA; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:link { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #AAACAF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:visited { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #AAACAF; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:active { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #9998A0; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
a.help:hover { font-size: 10px; font-weight: bold; background: #FFFFFF; color: #9998A0; padding: 0em 0.7em; margin: 0em 0.5em; text-decoration: none; white-space: nowrap; }
div.blockvmenupair
@ -1654,10 +1654,14 @@ background: #c0c4c7;
border: 0px;
}
tr.fiche {
font-family: <?php print $fontlist ?>;
.formboxfilter {
vertical-align: middle;
}
.formboxfilter input[type=image]
{
top: 4px;
position: relative;
}

View File

@ -543,14 +543,12 @@ div.tmenudisabled, a.tmenudisabled {
opacity: 0.6;
}
a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudisabled:active {
color: #808080;
font-weight: normal;
padding: 0px 5px 0px 5px;
margin: 0px 1px 2px 1px;
cursor: not-allowed;
font-weight: normal;
white-space: nowrap;
color: #<?php echo $colortextbackhmenu; ?>;
text-decoration: none;
cursor: not-allowed;
}
a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
@ -561,31 +559,11 @@ a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
color: #<?php echo $colortextbackhmenu; ?>;
text-decoration: none;
}
a.tmenu:link, a.tmenu:visited {
color: #<?php echo $colortextbackhmenu; ?>;
}
a.tmenu:hover, a.tmenu:active {
margin: 0px 0px 0px 0px;
/* border-<?php print $right; ?>: 1px solid #555555; */
/* border-<?php print $left; ?>: 1px solid #D8D8D8; */
/* border-top: 1px solid #D8D8D8; */
/* border-bottom: 2px solid #F4F4F4; */
/* background: #F4F4F4; */
/* text-shadow: 1px 1px 1px #FFFFFF !important; */
color: #<?php echo $colortextbackhmenu; ?>;
}
a.tmenusel:link, a.tmenusel:visited, a.tmenusel:hover, a.tmenusel:active {
font-weight: normal;
padding: 0px 5px 0px 5px;
margin: 0px 0px 0px 0px;
/* background: #F4F4F4; */
/* border-<?php print $right; ?>: 1px solid #555555; */
/* border-top: 1px solid #D8D8D8; */
/* border-<?php print $left; ?>: 1px solid #D8D8D8; */
/* border-bottom: 2px solid #F4F4F4; */
white-space: nowrap;
/* text-shadow: 1px 1px 1px #FFFFFF;*/
color: #<?php echo $colortextbackhmenu; ?>;
text-decoration: none !important;
}
@ -1579,7 +1557,6 @@ span.butAction, span.butActionDelete {
}
#undertopmenu {
/* background-image: url("<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/gradient.gif',1) ?>"); */
background-repeat: repeat-x;
margin-top: <?php echo ($dol_hide_topmenu?'6':'0'); ?>px;
}
@ -1963,9 +1940,15 @@ tr.box_pair {
font-family: <?php print $fontlist ?>;
}
tr.fiche {
font-family: <?php print $fontlist ?>;
.formboxfilter {
vertical-align: middle;
}
.formboxfilter input[type=image]
{
top: 5px;
position: relative;
}

View File

@ -281,4 +281,4 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldcustomer,$dura
}
}
?>
?>

View File

@ -279,4 +279,4 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta
}
}
?>
?>

View File

@ -256,4 +256,4 @@ function dolValidElement($element)
return (trim($element) != '');
}
?>
?>

View File

@ -311,4 +311,4 @@ function dolValidElement($element)
return (trim($element) != '');
}
?>
?>