Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
333ae9d496
@ -523,7 +523,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$keyforbreak = 'duration';
|
$keyforbreak = 'duration';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TotalCost").'</td><td>'.price($object->total_cost).'</td></tr>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
|
|||||||
@ -1013,11 +1013,20 @@ class BOM extends CommonObject
|
|||||||
$this->unit_cost = 0;
|
$this->unit_cost = 0;
|
||||||
$this->total_cost = 0;
|
$this->total_cost = 0;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
|
$productFournisseur = new ProductFournisseur($this->db);
|
||||||
|
|
||||||
foreach ($this->lines as &$line) {
|
foreach ($this->lines as &$line) {
|
||||||
$tmpproduct = new Product($this->db);
|
$tmpproduct = new Product($this->db);
|
||||||
$tmpproduct->fetch($line->fk_product);
|
$tmpproduct->fetch($line->fk_product);
|
||||||
|
$line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
|
||||||
|
if (empty($line->unit_cost)) {
|
||||||
|
if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0)
|
||||||
|
{
|
||||||
|
$line->unit_cost = $productFournisseur->fourn_unitprice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$line->unit_cost = (!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp; // TODO : add option to work with cost_price or pmp
|
|
||||||
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
|
$line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
|
||||||
$this->total_cost += $line->total_cost;
|
$this->total_cost += $line->total_cost;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -334,9 +334,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
|
|||||||
* @param string $outputfile Output file
|
* @param string $outputfile Output file
|
||||||
* @param string $filter (optional) Filter
|
* @param string $filter (optional) Filter
|
||||||
* @param string $url Url (If empty, forge URL for agenda RSS export)
|
* @param string $url Url (If empty, forge URL for agenda RSS export)
|
||||||
|
* @param string $langcode Language code to show in header
|
||||||
* @return int < 0 if ko, Nb of events in file if ok
|
* @return int < 0 if ko, Nb of events in file if ok
|
||||||
*/
|
*/
|
||||||
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '')
|
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '', $langcode = '')
|
||||||
{
|
{
|
||||||
global $user, $conf, $langs;
|
global $user, $conf, $langs;
|
||||||
global $dolibarr_main_url_root;
|
global $dolibarr_main_url_root;
|
||||||
@ -362,7 +363,9 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
|
|||||||
fwrite($fichier, '<rss version="2.0">');
|
fwrite($fichier, '<rss version="2.0">');
|
||||||
fwrite($fichier, "\n");
|
fwrite($fichier, "\n");
|
||||||
|
|
||||||
fwrite($fichier, "<channel>\n<title>".$title."</title>\n");
|
fwrite($fichier, "<channel>\n");
|
||||||
|
fwrite($fichier, "<title>".$title."</title>\n");
|
||||||
|
if ($langcode) fwrite($fichier, "<language>".$langcode."</language>\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n".
|
fwrite($fichier, "<description><![CDATA[".$desc.".]]></description>"."\n".
|
||||||
|
|||||||
@ -74,3 +74,4 @@ ProductsToConsume=Products to consume
|
|||||||
ProductsToProduce=Products to produce
|
ProductsToProduce=Products to produce
|
||||||
UnitCost=Unit cost
|
UnitCost=Unit cost
|
||||||
TotalCost=Total cost
|
TotalCost=Total cost
|
||||||
|
BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price)
|
||||||
@ -128,3 +128,5 @@ UseManifest=Provide a manifest.json file
|
|||||||
PublicAuthorAlias=Public author alias
|
PublicAuthorAlias=Public author alias
|
||||||
AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are defined into website properties
|
AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are defined into website properties
|
||||||
ReplacementDoneInXPages=Replacement done in %s pages or containers
|
ReplacementDoneInXPages=Replacement done in %s pages or containers
|
||||||
|
RSSFeed=RSS Feed
|
||||||
|
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL
|
||||||
@ -2978,6 +2978,14 @@ if ($action == 'editcss')
|
|||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// RSS
|
||||||
|
print '<tr><td class="tdtop">';
|
||||||
|
$htmlhelp = $langs->trans('RSSFeedDesc');
|
||||||
|
print $form->textwithpicto($langs->trans('RSSFeed'), $htmlhelp, 1, 'help', '', 0, 2, '');
|
||||||
|
print '</td><td>';
|
||||||
|
print '/wrapper.php?rss=1[&l=XX][&limit=123]';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
@ -12,6 +12,8 @@ $hashp = GETPOST('hashp', 'aZ09');
|
|||||||
$modulepart = GETPOST('modulepart', 'aZ09');
|
$modulepart = GETPOST('modulepart', 'aZ09');
|
||||||
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
|
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
|
||||||
$original_file = GETPOST("file", "alpha");
|
$original_file = GETPOST("file", "alpha");
|
||||||
|
$l = GETPOST('l', 'aZ09');
|
||||||
|
$limit = GETPOST('limit', 'int');
|
||||||
|
|
||||||
// Parameters for RSS
|
// Parameters for RSS
|
||||||
$rss = GETPOST('rss', 'aZ09');
|
$rss = GETPOST('rss', 'aZ09');
|
||||||
@ -90,8 +92,8 @@ if ($rss) {
|
|||||||
$type = '';
|
$type = '';
|
||||||
$cachedelay = 0;
|
$cachedelay = 0;
|
||||||
$filename = $original_file;
|
$filename = $original_file;
|
||||||
$filters = array('type_container'=>'blogpost', 'lang'=>'en_US');
|
|
||||||
$dir_temp = $conf->website->dir_temp;
|
$dir_temp = $conf->website->dir_temp;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||||
$website = new Website($db);
|
$website = new Website($db);
|
||||||
@ -99,7 +101,10 @@ if ($rss) {
|
|||||||
|
|
||||||
$website->fetch('', $websitekey);
|
$website->fetch('', $websitekey);
|
||||||
|
|
||||||
$MAXNEWS = 20;
|
$filters = array('type_container'=>'blogpost');
|
||||||
|
if ($l) $filters['lang'] = $l;
|
||||||
|
|
||||||
|
$MAXNEWS = ($limit ? $limit : 20);
|
||||||
$arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters);
|
$arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters);
|
||||||
$eventarray = array();
|
$eventarray = array();
|
||||||
if (is_array($arrayofblogs)) {
|
if (is_array($arrayofblogs)) {
|
||||||
@ -151,7 +156,7 @@ if ($rss) {
|
|||||||
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
|
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
// Write file
|
// Write file
|
||||||
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1');
|
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user