develop_dict
This commit is contained in:
Regis Houssin
2017-06-12 21:24:10 +02:00
89 changed files with 1219 additions and 657 deletions

View File

@@ -503,6 +503,14 @@ $tabfieldcheck[34] = array();
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
// Defaut sortorder
if (empty($sortfield))
{
$tmp1 = explode(',',$tabsqlsort[$id]);
$tmp2 = explode(' ',$tmp1[0]);
$sortfield=preg_replace('/^.*\./', '', $tmp2[0]);
}
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList=array();
@@ -947,7 +955,8 @@ if ($id)
if (! preg_match('/ WHERE /',$sql)) $sql.= " WHERE 1 = 1";
if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id;
if ($search_code != '') $sql.= natural_search("code", $search_code);
if ($search_code != '' && $id != 9) $sql.= natural_search("code", $search_code);
if ($search_code != '' && $id == 9) $sql.= natural_search("code_iso", $search_code);
if ($sortfield)
{

View File

@@ -101,20 +101,20 @@ print $block_static->getSignature();
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_AUTHORITY_URL">';
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_AUTHORITY_URL">';
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
}
print '</table>';

View File

@@ -74,7 +74,7 @@ print $langs->trans("FingerprintsDesc")."<br>\n";
print '<br>';
echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a> <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a></div>';
echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a> | <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a></div>';
print '<table class="noborder" width="100%">';
@@ -97,15 +97,16 @@ foreach($blocks as &$block) {
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
print '<td>'.$block->ref_object.'</td>';
print '<td>'.$langs->trans('log'.$block->action).'</td>';
print '<td>'.$block->getObject().'</td>';
print '<td>'.$block->getObject().'<a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
print '<td align="right">'.price($block->amounts).'</td>';
print '<td>'.$block->getUser().'</td>';
print '<td>'.$block->signature.'</td>';
print '<td>';
print $block->checkSignature() ? img_picto('OkCheckPaymentValidity', 'on') : img_picto($langs->trans('KoCheckPaymentValidity'), 'off');
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
print $block->checkSignature() ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off');
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
}
print '</td>';
print '</tr>';
@@ -113,6 +114,54 @@ foreach($blocks as &$block) {
print '</table>';
?>
<script type="text/javascript">
$('a[rel=show-info]').click(function() {
$pop = $('<div id="pop-info"><table width="100%" class="border"><thead><th width="25%"><?php echo $langs->trans('Field') ?></th><th><?php echo $langs->trans('Value') ?></th></thead><tbody></tbody></table></div>');
$pop.dialog({
title:"<?php echo $langs->trans('BlockedlogInfoDialog'); ?>"
,modal:true
,width:'80%'
});
var fk_block = $(this).attr("blockid");
$.ajax({
url:"../ajax/block-info.php?id="+fk_block
,dataType:'json'
}).done(function(data) {
drawData(data,'');
});
});
function drawData(data, prefix) {
for(x in data) {
value = data[x];
$('#pop-info table tbody').append('<tr><td>'+prefix+x+'</td><td>'+value+'</td></tr>');
if( (typeof value === "object") && (value !== null) ) {
drawData(value, prefix+x+' &gt;&gt; ');
}
}
}
</script>
<?php
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
?>
<script type="text/javascript">
@@ -134,6 +183,8 @@ print '</table>';
<?php
}
dol_fiche_end();
print '<br><br>';

View File

@@ -0,0 +1,15 @@
<?php
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$id = GETPOST('id');
$block = new BlockedLog($db);
if($block->fetch($id)>0) {
echo json_encode($block->object_data);
}
else {
echo json_encode(false);
}

View File

@@ -294,7 +294,7 @@ class BlockedLogAuthority
//TODO create cron task on activation
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL) || empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
$this->error = $langs->trans('NoAuthorityURLDefined');
return -2;
}

View File

@@ -34,8 +34,8 @@ if ( $_GET['id'] == 'NOUV' )
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
if (isset($_SESSION['serObjFacturation']))
{
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
}
else
{
@@ -43,7 +43,7 @@ else
$obj_facturation = new Facturation();
}
// $obj_facturation contains data for all invoice total + selection of current product
$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']

View File

@@ -99,17 +99,25 @@ class Facturation
$product = new Product($db);
$product->fetch($this->id);
$vatrowid = $this->tva();
$tmp = getTaxesFromId($vatrowid);
$vat_rate = $tmp['rate'];
$txtva = $tmp['rate'].(empty($tmp['code'])?'':' ('.$tmp['code'].')');
$vat_npr = $tmp['npr'];
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Define part of HT, VAT, TTC
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
// Calcul du total ht sans remise
$total_ht = $resultarray[0];
@@ -136,7 +144,7 @@ class Facturation
$newcartarray[$i]['label']=$product->label;
$newcartarray[$i]['price']=$product->price;
$newcartarray[$i]['price_ttc']=$product->price_ttc;
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
if (isset($product->multiprices[$societe->price_level]))
@@ -148,7 +156,7 @@ class Facturation
$newcartarray[$i]['fk_article']=$this->id;
$newcartarray[$i]['qte']=$this->qte();
$newcartarray[$i]['fk_tva']=$this->tva();
$newcartarray[$i]['fk_tva']=$this->tva(); // Vat rowid
$newcartarray[$i]['remise_percent']=$remise_percent;
$newcartarray[$i]['remise']=price2num($montant_remise_ht);
$newcartarray[$i]['total_ht']=price2num($total_ht,'MT');
@@ -220,7 +228,7 @@ class Facturation
$this->prix_total_vat = $total_vat;
$this->prix_total_localtax1 = $total_localtax1;
$this->prix_total_localtax2 = $total_localtax2;
$this->montant_tva = $total_ttc - $total_ht;
//print $this->prix_total_ttc.'eeee'; exit;
}

View File

@@ -35,7 +35,7 @@
$form=new Form($db);
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if ( GETPOST('filtre') ) {
if ( GETPOST('filtre','alpha') ) {
// Avec filtre
$ret=array(); $i=0;
@@ -47,22 +47,23 @@ if ( GETPOST('filtre') ) {
$sql.= " WHERE p.entity IN (".getEntity('product').")";
$sql.= " AND p.tosell = 1";
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
$sql.= " AND (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (! empty($conf->barcode->enabled)) {
$filtre = GETPOST('filtre');
$sql.= " AND (";
$sql.= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (! empty($conf->barcode->enabled))
{
$filtre = GETPOST('filtre','alpha');
//If the barcode looks like an EAN13 format and the last digit is included in it,
//then whe look for the 12-digit too
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
if (strlen($filtre) == 13) {
$crit_12digit = substr($filtre, 0, 12);
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%')";
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
} else {
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%')";
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%'";
}
}
else $sql.= ")";
$sql.= ")";
$sql.= " ORDER BY label";
dol_syslog("facturation.php", LOG_DEBUG);
@@ -154,34 +155,6 @@ global $mysoc;
$ret=array();
$i=0;
$sql = "SELECT t.rowid, t.taux";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
$sql.= ", ".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE t.fk_pays = c.rowid";
$sql.= " AND t.active = 1";
$sql.= " AND c.code = '".$mysoc->country_code."'";
//print $sql;
$resql = $db->query($sql);
if ($resql)
{
while ( $tab = $db->fetch_array($resql) )
{
foreach ( $tab as $cle => $valeur )
{
$ret[$i][$cle] = $valeur;
}
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
$tab_tva = $ret;
// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
$obj_facturation->getSetPaymentMode('RESET');
$obj_facturation->montantEncaisse('RESET');

View File

@@ -39,7 +39,7 @@ switch($action)
default:
if ( $_POST['hdnSource'] != 'NULL' )
{
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.recuperableonly";
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".$conf_fkentrepot;
@@ -56,7 +56,6 @@ switch($action)
}
$result = $db->query($sql);
if ($result)
{
// ... et enregistrement dans l'objet
@@ -69,62 +68,90 @@ switch($action)
$ret[$key] = $value;
}
// Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function
$productid = $ret['rowid'];
$product = new Product($db);
$product->fetch($productid);
$prod = $product;
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$tva_tx = get_default_tva($mysoc,$societe,$productid);
$tva_npr = get_default_npr($mysoc,$societe,$productid);
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $societe, $product->id);
$tva_npr = get_default_npr($mysoc, $societe, $product->id);
if (empty($tva_tx)) $tva_npr=0;
dol_syslog('tva_tx='.$tva_tx.'-tva_npr='.$tva_npr);
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
$price_base_type = $prod->price_base_type;
// multiprix
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($societe->price_level))
{
if(isset($product->multiprices[$societe->price_level]))
{
$ret['price'] = $product->multiprices[$societe->price_level];
$ret['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
// $product->multiprices_min[$societe->price_level];
// $product->multiprices_min_ttc[$societe->price_level];
// $product->multiprices_base_type[$societe->price_level];
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level];
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level];
if (empty($tva_tx)) $tva_npr=0;
}
}
$pu_ht = $prod->multiprices[$societe->price_level];
$pu_ttc = $prod->multiprices_ttc[$societe->price_level];
$price_min = $prod->multiprices_min[$societe->price_level];
$price_base_type = $prod->multiprices_base_type[$societe->price_level];
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
if (isset($prod->multiprices_tva_tx[$societe->price_level])) $tva_tx=$prod->multiprices_tva_tx[$societe->price_level];
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$societe->price_level];
}
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $societe->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result >= 0)
{
if (count($prodcustprice->lines) > 0)
{
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$tva_tx = $prodcustprice->lines [0]->tva_tx;
}
}
else
{
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
}
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (! empty($price_ht)) {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tmpvat != $tmpprodvat) {
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
}
$ret['tva_tx'] = $tva_tx;
$ret['tva_npr'] = $tva_npr;
//var_dump('tva_tx='.$ret['tva_tx'].'-tva_npr='.$ret['tva_npr'].'-'.$conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL);exit;
$obj_facturation->id($ret['rowid']);
$obj_facturation->ref($ret['ref']);
$obj_facturation->stock($ret['reel']);
$obj_facturation->prix($ret['price']);
// Use $ret['tva_tx'] / ret['tva_npr'] to find vat id
$vatrowid = null;
$sqlfindvatid = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'c_tva';
$sqlfindvatid.= ' WHERE taux = '.$ret['tva_tx'].' AND recuperableonly = '.(int) $ret['tva_npr'];
$sqlfindvatid.= ' AND fk_pays = '.$mysoc->country_id;
$resqlfindvatid=$db->query($sqlfindvatid);
if ($resqlfindvatid)
{
$obj = $db->fetch_object($resqlfindvatid);
if ($obj) $vatrowid = $obj->rowid;
}
else dol_print_error($db);
dol_syslog("save vatrowid=".$vatrowid);
$obj_facturation->tva($vatrowid); // Save vat it for next use
$vatrate = $tva_tx;
$obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code)
// Definition du filtre pour n'afficher que le produit concerne
if ( $_POST['hdnSource'] == 'LISTE' )
@@ -170,21 +197,21 @@ switch($action)
{
$_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid;
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
break;
case 'ajout_article': // We have clicked on button "Add product"
if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it
{
dol_syslog("facturation_verif save vat ".$_POST['selTva']);
$obj_facturation->qte($_POST['txtQte']);
$obj_facturation->tva($_POST['selTva']); // Save VAT selected so we can use it for next product
$obj_facturation->tva($_POST['selTva']); // id of vat. Saved so we can use it for next product
$obj_facturation->remisePercent($_POST['txtRemise']);
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
// We update prixTotalTtc
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';

View File

@@ -125,12 +125,12 @@ $langs->load("cashdesk");
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
<!-- Choix du taux de TVA -->
<td class="select_tva">
<?php //var_dump($tab_tva);
$tva_tx = $obj_facturation->tva(); // Try to get a previously entered VAT rowid. First time, this will return empty.
<?php
$vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
$buyer = new Societe($db);
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):-1), $mysoc, $buyer, 0, 0, '', false, -1);
echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva",'alpha',2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
?>
</td>
</tr>

View File

@@ -184,6 +184,7 @@ switch ($action)
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
$vat_rate = $tmp['rate'];
$vat_npr = $tmp['npr'];
$vat_src_code = $tmp['code'];
$invoiceline=new FactureLigne($db);
$invoiceline->fk_product=$tab_liste[$i]['fk_article'];
@@ -195,12 +196,14 @@ switch ($action)
$invoiceline->tva_tx=empty($vat_rate)?0:$vat_rate; // works even if vat_rate is ''
$invoiceline->info_bits=empty($vat_npr)?0:$vat_npr;
$invoiceline->vat_src_code=$vat_src_code;
$invoiceline->total_ht=$tab_liste[$i]['total_ht'];
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
$invoiceline->total_tva=$tab_liste[$i]['total_vat'];
$invoiceline->total_localtax1=$tab_liste[$i]['total_localtax1'];
$invoiceline->total_localtax2=$tab_liste[$i]['total_localtax2'];
$invoice->lines[]=$invoiceline;
}

View File

@@ -1884,7 +1884,7 @@ class Propal extends CommonObject
{
$this->oldcopy= clone $this;
$this->fk_availability = $id;
$this->availability_id = $availability_id;
$this->availability_id = $id;
}
if (! $notrigger && empty($error))

View File

@@ -522,9 +522,12 @@ class Facture extends CommonInvoice
{
$newinvoiceline=$this->lines[$i];
$newinvoiceline->fk_facture=$this->id;
$newinvoiceline->origin = $this->element; // TODO This seems not used. Here we but origin 'facture' but after
$newinvoiceline->origin_id = $this->lines[$i]->id; // we put an id of object !
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
// TODO This seems not used. Here we put origin 'facture' but after, we put an id of object !
$newinvoiceline->origin = $this->element;
$newinvoiceline->origin_id = $this->lines[$i]->id;
if ($result >= 0)
{
// Reset fk_parent_line for no child products and special product
if (($newinvoiceline->product_type != 9 && empty($newinvoiceline->fk_parent_line)) || $newinvoiceline->product_type == 9) {
@@ -561,7 +564,7 @@ class Facture extends CommonInvoice
//if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object.
if (! is_object($line)) $line = (object) $line;
if (($line->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
if ($result >= 0)
{
// Reset fk_parent_line for no child products and special product
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {

View File

@@ -44,6 +44,21 @@ class box_actions extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
global $user;
$this->db = $db;
$this->hidden = ! ($user->rights->agenda->myactions->read);
}
/**
* Load data for box to show them later
*
@@ -173,8 +188,8 @@ class box_actions extends ModeleBoxes
function showBox($head = null, $contents = null, $nooutput=0)
{
global $langs, $conf;
parent::showBox($this->info_box_head, $this->info_box_contents);
$out='';
$out = parent::showBox($this->info_box_head, $this->info_box_contents);
if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
{
$actioncejour=false;

View File

@@ -51,11 +51,17 @@ class box_activity extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $conf, $user;
$this->db=$db;
// FIXME: Pb into some status
$this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous comments)
$this->enabled=($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
$this->hidden= ! ((! empty($conf->facture->enabled) && $user->rights->facture->lire)
|| (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|| (! empty($conf->propal->enabled) && $user->rights->propale->lire)
);
}
/**
@@ -352,7 +358,7 @@ class box_activity extends ModeleBoxes
}
// list the summary of the propals
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
{
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic=new Propal($db);
@@ -456,10 +462,10 @@ class box_activity extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -40,6 +40,21 @@ class box_bookmarks extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->bookmark->lire);
}
/**
* Load data for box to show them later
*
@@ -136,11 +151,11 @@ class box_bookmarks extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -58,6 +58,8 @@ class box_clients extends ModeleBoxes
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
}
/**
@@ -160,11 +162,11 @@ class box_clients extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -44,6 +44,21 @@ class box_commandes extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->commande->lire);
}
/**
* Load data for box to show them later
*
@@ -177,11 +192,11 @@ class box_commandes extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -61,6 +61,8 @@ class box_comptes extends ModeleBoxes
// disable module for such cases
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (! in_array('banque',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
$this->hidden = ! ($user->rights->banque->lire);
}
/**
@@ -171,11 +173,11 @@ class box_comptes extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -45,6 +45,21 @@ class box_contacts extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->societe->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -164,11 +179,11 @@ class box_contacts extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -43,6 +43,21 @@ class box_contracts extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->contrat->lire);
}
/**
* Load data for box to show them later
*
@@ -160,11 +175,11 @@ class box_contracts extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -188,11 +188,11 @@ class box_external_rss extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -42,6 +42,21 @@ class box_factures extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->facture->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -181,11 +196,11 @@ class box_factures extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -43,6 +43,21 @@ class box_factures_fourn extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->fournisseur->facture->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -190,11 +205,11 @@ class box_factures_fourn extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -42,6 +42,21 @@ class box_factures_fourn_imp extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->fournisseur->facture->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -181,11 +196,11 @@ class box_factures_fourn_imp extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -45,6 +45,21 @@ class box_factures_imp extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->facture->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -184,11 +199,11 @@ class box_factures_imp extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -43,6 +43,21 @@ class box_ficheinter extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->ficheinter->lire);
}
/**
* Load data for box to show them later
*
@@ -147,11 +162,11 @@ class box_ficheinter extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -43,6 +43,21 @@ class box_fournisseurs extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -140,11 +155,11 @@ class box_fournisseurs extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -60,6 +60,8 @@ class box_goodcustomers extends ModeleBoxes
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
if (empty($conf->global->MAIN_BOX_ENABLE_BEST_CUSTOMERS)) $this->enabled=0; // not enabled by default. Very slow on large database
$this->hidden = ! ($user->rights->societe->lire);
}
/**
@@ -162,11 +164,11 @@ class box_goodcustomers extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -47,9 +47,11 @@ class box_graph_invoices_permonth extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $user;
$this->db=$db;
$this->hidden = ! ($user->rights->facture->lire);
}
/**
@@ -268,11 +270,11 @@ class box_graph_invoices_permonth extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -47,9 +47,11 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $user;
$this->db=$db;
$this->hidden = ! ($user->rights->fournisseur->facture->lire);
}
/**
@@ -267,11 +269,11 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -47,9 +47,11 @@ class box_graph_orders_permonth extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $user;
$this->db=$db;
$this->hidden = ! ($user->rights->commande->lire);
}
/**
@@ -266,11 +268,11 @@ class box_graph_orders_permonth extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -47,9 +47,11 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $user;
$this->db=$db;
$this->hidden = ! ($user->rights->fournisseur->commande->lire);
}
/**
@@ -265,11 +267,11 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -48,9 +48,15 @@ class box_graph_product_distribution extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $user, $conf;
$this->db=$db;
$this->hidden = ! (
(! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
|| (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire))
|| (! empty($conf->propal->enabled) && ! empty($user->rights->propale->lire))
);
}
/**
@@ -93,7 +99,7 @@ class box_graph_product_distribution extends ModeleBoxes
}
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; }
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0;
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0;
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) $showpropalnb=0;
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0;
$nowarray=dol_getdate(dol_now(),true);
@@ -187,7 +193,7 @@ class box_graph_product_distribution extends ModeleBoxes
}
}
if (! empty($conf->propal->enabled) && ! empty($user->rights->propal->lire))
if (! empty($conf->propal->enabled) && ! empty($user->rights->propale->lire))
{
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showpropalnb)
@@ -338,7 +344,7 @@ class box_graph_product_distribution extends ModeleBoxes
$stringtoshow.='<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb?' checked':'').'> '.$langs->trans("ForCustomersInvoices");
$stringtoshow.=' &nbsp; ';
}
if (! empty($conf->propal->enabled) || ! empty($user->rights->propal->lire))
if (! empty($conf->propal->enabled) || ! empty($user->rights->propale->lire))
{
$stringtoshow.='<input type="checkbox" name="'.$param_showpropalnb.'"'.($showpropalnb?' checked':'').'> '.$langs->trans("ForProposals");
$stringtoshow.='&nbsp;';
@@ -399,11 +405,11 @@ class box_graph_product_distribution extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -47,9 +47,11 @@ class box_graph_propales_permonth extends ModeleBoxes
*/
function __construct($db,$param)
{
global $conf;
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->propale->lire);
}
/**
@@ -87,7 +89,7 @@ class box_graph_propales_permonth extends ModeleBoxes
if ($user->societe_id) $socid=$user->societe_id;
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
if ($user->rights->propal->lire)
if ($user->rights->propale->lire)
{
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
@@ -267,11 +269,11 @@ class box_graph_propales_permonth extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -60,6 +60,8 @@ class box_members extends ModeleBoxes
// disable module for such cases
$listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (! in_array('adherent',$listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
$this->hidden=! ($user->rights->adherent->lire);
}
/**
@@ -170,11 +172,11 @@ class box_members extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -45,6 +45,21 @@ class box_produits extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->produit->lire || $user->rights->service->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -72,7 +87,7 @@ class box_produits extends ModeleBoxes
// Add where from hooks
if (is_object($hookmanager))
{
$parameters=array();
$parameters=array('boxproductlist'=>1);
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
}
@@ -162,12 +177,14 @@ class box_produits extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tosell,3,0),
'text' => '<span class="statusrefsell">'.$productstatic->LibStatut($objp->tosell,3,0).'<span>',
'asis' => 1
);
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tobuy,3,1),
'text' => '<span class="statusrefbuy">'.$productstatic->LibStatut($objp->tobuy,3,1).'</span>',
'asis' => 1
);
$line++;
@@ -200,11 +217,11 @@ class box_produits extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -47,6 +47,21 @@ class box_produits_alerte_stock extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
global $user;
$this->db = $db;
$this->hidden = ! (($user->rights->produit->lire || $user->rights->service->lire) && $user->rights->stock->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -64,7 +79,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleProductsAlertStock",$max));
if ($user->rights->produit->lire || $user->rights->service->lire)
if (($user->rights->produit->lire || $user->rights->service->lire) && $user->rights->stock->lire)
{
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity,";
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
@@ -77,7 +92,7 @@ class box_produits_alerte_stock extends ModeleBoxes
// Add where from hooks
if (is_object($hookmanager))
{
$parameters=array();
$parameters=array('boxproductalertstocklist'=>1);
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
}
@@ -164,15 +179,22 @@ class box_produits_alerte_stock extends ModeleBoxes
'text' => $price_base_type,
);
$this->info_box_contents[$line][] = array('td' => 'align="center"',
$this->info_box_contents[$line][] = array(
'td' => 'align="center"',
'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte,
'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit", $objp->seuil_stock_alerte)));
$this->info_box_contents[$line][] = array('td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tosell,3,0));
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => '<span class="statusrefsell">'.$productstatic->LibStatut($objp->tosell,3,0).'<span>',
'asis' => 1
);
$this->info_box_contents[$line][] = array('td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->tobuy,3,1));
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => '<span class="statusrefbuy">'.$productstatic->LibStatut($objp->tobuy,3,0).'<span>',
'asis' => 1
);
$line++;
}
@@ -207,11 +229,11 @@ class box_produits_alerte_stock extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -48,12 +48,14 @@ class box_project extends ModeleBoxes
*/
function __construct($db,$param='')
{
global $langs;
global $user, $langs;
$langs->load("boxes");
$langs->load("projects");
$this->db = $db;
$this->boxlabel="Projects";
$this->hidden=! ($user->rights->projet->lire);
}
/**
@@ -77,16 +79,16 @@ class box_project extends ModeleBoxes
// list the summary of the orders
if ($user->rights->projet->lire) {
include_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
$projectstatic = new Project($this->db);
$socid=$user->societe_id;
// Get list of project id allowed to user (in a string list separated by coma)
$projectsListId='';
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc";
@@ -96,7 +98,7 @@ class box_project extends ModeleBoxes
$sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
$sql.= " ORDER BY p.datec DESC";
//$sql.= $db->plimit($max, 0);
@@ -156,7 +158,7 @@ class box_project extends ModeleBoxes
}
if ($max < $num)
{
$this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...');
$this->info_box_contents[$i][0] = array('td' => 'colspan="5"', 'text' => '...');
$i++;
}
}
@@ -195,11 +197,11 @@ class box_project extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -44,6 +44,21 @@ class box_propales extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->propale->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -167,11 +182,11 @@ class box_propales extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -60,6 +60,8 @@ class box_prospect extends ModeleBoxes
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option
$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
}
/**
@@ -168,11 +170,11 @@ class box_prospect extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -43,6 +43,21 @@ class box_services_contracts extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->service->lire && $user->rights->contrat->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -175,11 +190,11 @@ class box_services_contracts extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -42,6 +42,21 @@ class box_services_expired extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->contrat->lire);
}
/**
* Load data for box to show them later
*
@@ -153,11 +168,11 @@ class box_services_expired extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -43,6 +43,21 @@ class box_supplier_orders extends ModeleBoxes
var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param)
{
global $user;
$this->db=$db;
$this->hidden=! ($user->rights->fournisseur->commande->lire);
}
/**
* Load data into info_box_contents array to show array later.
*
@@ -172,11 +187,11 @@ class box_supplier_orders extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -42,6 +42,7 @@ class box_task extends ModeleBoxes
var $info_box_head = array();
var $info_box_contents = array();
/**
* Constructor
*
@@ -50,11 +51,13 @@ class box_task extends ModeleBoxes
*/
function __construct($db,$param='')
{
global $langs;
global $user, $langs;
$langs->load("boxes");
$langs->load("projects");
$this->boxlabel="Tasks";
$this->db = $db;
$this->hidden = ! ($user->rights->projet->lire);
}
/**
@@ -138,10 +141,10 @@ class box_task extends ModeleBoxes
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return void
* @return string
*/
function showBox($head = null, $contents = null, $nooutput=0)
{
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@@ -49,10 +49,15 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
public $max = 5;
/**
* @var int Status
* @var int Condition to have widget enabled
*/
public $enabled=1;
/**
* @var int Condition to have widget visible (in most cases, permissions)
*/
public $hidden=0;
/**
* @var int Box definition database ID
*/
@@ -168,29 +173,29 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
}
}
/**
* Standard method to get content of a box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
*
* @return string
* @return string
*/
function outputBox($head = null, $contents = null)
{
global $langs, $user, $conf;
// Trick to get result into a var from a function that makes print instead of return
// TODO Replace ob_start with param nooutput=1 into showBox
ob_start();
$result = $this->showBox($head, $contents);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
/**
* Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
*
@@ -203,6 +208,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
{
global $langs, $user, $conf;
if (! empty($this->hidden)) return '\n<!-- Box ".get_class($this)." hidden -->\n'; // Nothing done if hidden (for example when user has no permission)
require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
@@ -363,13 +370,13 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$out = "<!-- Box ".get_class($this)." from cache -->";
$out.= dol_readcachefile($cachedir, $filename);
}
if ($nooutput) return $out;
else print $out;
return '';
}
}

View File

@@ -322,7 +322,7 @@ class FormOther
{
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
}
// Load list of "categories"
$static_categs = new Categorie($this->db);
$tab_categs = $static_categs->get_full_arbo($type);
@@ -411,7 +411,7 @@ class FormOther
$sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
}
$sql_usr.= " ORDER BY u.statut DESC, lastname ASC";
$sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
//print $sql_usr;exit;
$resql_usr = $this->db->query($sql_usr);
@@ -623,12 +623,12 @@ class FormOther
$b = hexdec($hexb);
}
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
if ($bright > 0.6) $textcolor='000';
if ($bright > 0.6) $textcolor='000';
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$color = colorArrayToHex(colorStringToArray($color,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">';
else print $textifnotdefined;
}
@@ -991,7 +991,7 @@ class FormOther
* Class 'Form' must be known.
*
* @param User $user Object User
* @param String $areacode Code of area for pages (0=value for Home page)
* @param String $areacode Code of area for pages ('0'=value for Home page)
* @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>)
*/
static function getBoxesArea($user,$areacode)
@@ -1004,16 +1004,16 @@ class FormOther
// $boxactivated will be array of boxes enabled into global setup
// $boxidactivatedforuser will be array of boxes choosed by user
$selectboxlist='';
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,(empty($user->conf->$confuserzone)?null:$user)); // Search boxes of common+user (or common only if user has no specific setup)
$boxactivated=InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone)?null:$user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup)
$boxidactivatedforuser=array();
foreach($boxactivated as $box)
{
if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
}
// Define selectboxlist
$arrayboxtoactivatelabel=array();
if (! empty($user->conf->$confuserzone))

View File

@@ -45,9 +45,10 @@ class InfoBox
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...)
* @param User|null $user Object user to filter
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
* @param int $includehidden Include also hidden boxes
* @return array Array of boxes
*/
static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array())
static function listBoxes($db, $mode, $zone, $user=null, $excludelist=array(), $includehidden=1)
{
global $conf;
@@ -155,7 +156,7 @@ class InfoBox
//print '=>'.$boxname.'-enabled='.$enabled.'<br>';
//print 'xx module='.$module.' enabled='.$enabled;
if ($enabled) $boxes[]=$box;
if ($enabled && ($includehidden || empty($box->hidden))) $boxes[]=$box;
else unset($box);
}
else

View File

@@ -1777,11 +1777,12 @@ function dol_compress_dir($inputdir, $outputfile, $mode="zip")
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
* @param int $nohook Disable all hooks
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
* @return string Full path to most recent file
*/
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview.*\.png)$','^\.'),$nohook=false)
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview.*\.png)$','^\.'),$nohook=false,$mode='')
{
$tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,'',$nohook);
$tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,$mode,$nohook);
return $tmparray[0];
}

View File

@@ -1298,14 +1298,14 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlstatus.=ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
$morehtmlstatus.=$object->getLibStatut(5,0);
$morehtmlstatus.='<span class="statusrefsell">'.$object->getLibStatut(5,0).'</span>';
}
$morehtmlstatus.=' &nbsp; ';
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlstatus.=ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
$morehtmlstatus.=$object->getLibStatut(5,1);
$morehtmlstatus.='<span class="statusrefbuy">'.$object->getLibStatut(5,1).'</span>';
}
}
elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan')))

View File

@@ -147,7 +147,9 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
$readok=1; $nbko=0;
foreach ($featuresarray as $feature) // first we check nb of test ko
{
if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($feature,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
$featureforlistofmodule=$feature;
if ($featureforlistofmodule == 'produit') $featureforlistofmodule='product';
if (! empty($user->societe_id) && ! empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && ! in_array($featureforlistofmodule,$listofmodules)) // If limits on modules for external users, module must be into list of modules for external users
{
$readok=0; $nbko++;
continue;

View File

@@ -167,9 +167,17 @@ class pdf_aurore extends ModelePDFSupplierProposal
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
}
else
{
$pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/';
$dir = $conf->product->dir_output.'/'.$pdir;
}
$realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{

View File

@@ -109,9 +109,9 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex
else
{
$now = dol_now(); // Date we start
$result=$object->run_jobs($user->login);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@@ -155,7 +155,7 @@ if ($action=='add')
$object->unitfrequency=GETPOST('unitfrequency','int');
$object->frequency=GETPOST('nbfrequency','int');
$object->maxrun=GETPOST('maxrun','int');
// Add cron task
$result = $object->create($user);
@@ -191,7 +191,7 @@ if ($action=='update')
$object->unitfrequency=GETPOST('unitfrequency','int');
$object->frequency=GETPOST('nbfrequency','int');
$object->maxrun=GETPOST('maxrun','int');
// Add cron task
$result = $object->update($user);
@@ -353,7 +353,7 @@ if (($action=="create") || ($action=="edit"))
print '<tr class="blockmethod"><td>';
print $langs->trans('CronClassFile')."</td><td>";
print "<input type=\"text\" size=\"20\" name=\"classesname\" value=\"".$object->classesname."\" /> ";
print '<input type="text" class="minwidth300" name="classesname" value="'.$object->classesname.'" /> ';
print "</td>";
print "<td>";
print $form->textwithpicto('',$langs->trans("CronClassFileHelp"),1,'help');
@@ -371,7 +371,7 @@ if (($action=="create") || ($action=="edit"))
print '<tr class="blockmethod"><td>';
print $langs->trans('CronMethod')."</td><td>";
print "<input type=\"text\" size=\"20\" name=\"methodename\" value=\"".$object->methodename."\" /> ";
print '<input type="text" class="minwidth300" name="methodename" value="'.$object->methodename.'" /> ';
print "</td>";
print "<td>";
print $form->textwithpicto('',$langs->trans("CronMethodHelp"),1,'help');
@@ -431,7 +431,7 @@ if (($action=="create") || ($action=="edit"))
}
$input .= "<label for=\"frequency_minute\">".$langs->trans('Minutes')."</label>";
print $input;
$input = " <input type=\"radio\" name=\"unitfrequency\" value=\"3600\" id=\"frequency_heures\" ";
if($object->unitfrequency=="3600"){
$input .= ' checked />';
@@ -441,7 +441,7 @@ if (($action=="create") || ($action=="edit"))
}
$input .= "<label for=\"frequency_heures\">".$langs->trans('Hours')."</label>";
print $input;
$input = " <input type=\"radio\" name=\"unitfrequency\" value=\"86400\" id=\"frequency_jours\" ";
if($object->unitfrequency=="86400"){
$input .= ' checked />';
@@ -451,7 +451,7 @@ if (($action=="create") || ($action=="edit"))
}
$input .= "<label for=\"frequency_jours\">".$langs->trans('Days')."</label>";
print $input;
$input = " <input type=\"radio\" name=\"unitfrequency\" value=\"604800\" id=\"frequency_semaine\" ";
if($object->unitfrequency=="604800"){
$input .= ' checked />';
@@ -465,7 +465,7 @@ if (($action=="create") || ($action=="edit"))
print "<td>";
print "</td>";
print "</tr>\n";
print "<tr><td>";
print $langs->trans('CronDtStart')."</td><td>";
if(!empty($object->datestart))
@@ -480,7 +480,7 @@ if (($action=="create") || ($action=="edit"))
print "<td>";
print "</td>";
print "</tr>\n";
print "<tr><td>";
print $langs->trans('CronDtEnd')."</td><td>";
if(!empty($object->dateend)){
@@ -493,7 +493,7 @@ if (($action=="create") || ($action=="edit"))
print "<td>";
print "</td>";
print "</tr>\n";
print "<tr><td>";
print $langs->trans('CronPriority')."</td>";
$priority=0;
@@ -505,7 +505,7 @@ if (($action=="create") || ($action=="edit"))
print "<td>";
print "</td>";
print "</tr>\n";
print '<tr><td>';
$maxrun='';
if (!empty($object->maxrun)) {
@@ -517,7 +517,7 @@ if (($action=="create") || ($action=="edit"))
print "<td>";
print "</td>";
print "</tr>\n";
print '<tr><td>';
print $langs->trans('CronDtNextLaunch');
print ' ('.$langs->trans('CronFrom').')';
@@ -529,14 +529,14 @@ if (($action=="create") || ($action=="edit"))
else
{
$form->select_date(-1,'datenextrun',1,1,'',"cronform");
}
}
print "</td>";
print "<td>";
print "</td>";
print "</tr>";
print '</table>';
dol_fiche_end();
print '<div align="center">';
@@ -554,24 +554,22 @@ else
* view card
*/
$now = dol_now();
dol_fiche_head($head, 'card', $langs->trans("CronTask"), -1, 'cron');
$linkback = '<a href="' . DOL_URL_ROOT . '/cron/list.php?status=-2">' . $langs->trans("BackToList") . '</a>';
// TODO Use dol_banner
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
// box add_jobs_box
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">';
print $langs->trans('CronId')."</td>";
print "<td>".$form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'id', '', '', 0);
print "</td></tr>\n";
print '<tr><td>';
print $langs->trans('CronLabel')."</td>";
print "<td>".$langs->trans($object->label);
print "</td></tr>";
@@ -616,21 +614,16 @@ else
print $langs->trans($object->note);
print "</td></tr>";
print '<tr><td>';
print $langs->trans('Active')."</td><td>";
print $object->getLibStatut(4);
print "</td></tr>";
print '</table>';
print '</div>';
print '<br>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">';
print $langs->trans('CronEvery')."</td>";
print "<td>";
@@ -639,33 +632,33 @@ else
if($object->unitfrequency == "86400") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Days');
if($object->unitfrequency == "604800") print $langs->trans('CronEach')." ".($object->frequency)." ".$langs->trans('Weeks');
print "</td></tr>";
print '<tr><td>';
print $langs->trans('CronDtStart')."</td><td>";
if(!empty($object->datestart)) {print dol_print_date($object->datestart,'dayhoursec');}
print "</td></tr>";
print "<tr><td>";
print $langs->trans('CronDtEnd')."</td><td>";
if(!empty($object->dateend)) {print dol_print_date($object->dateend,'dayhoursec');}
print "</td></tr>";
print "<tr><td>";
print $langs->trans('CronPriority')."</td>";
print "<td>".$object->priority;
print "</td></tr>";
print "<tr><td>";
print $langs->trans('CronMaxRun')."</td>";
print "<td>";
print $object->maxrun>0?$object->maxrun:'';
print "</td></tr>";
print "<tr><td>";
print $langs->trans('CronNbRun')."</td>";
print "<td>".$object->nbrun;
print "</td></tr>";
// Date next run (from)
print '<tr><td>';
print $langs->trans('CronDtNextLaunch');
@@ -673,18 +666,18 @@ else
print "</td><td>";
//print '<strong>';
if (! $object->status) print $langs->trans("Disabled");
elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');}
elseif (!empty($object->datenextrun)) { print img_picto('','object_calendarday').' '.dol_print_date($object->datenextrun,'dayhoursec');}
else {print $langs->trans('CronNone');}
//print '</strong>';
if ($object->maxnbrun && $object->nbrun >= $object->maxrun) print img_warning($langs->trans("Finished"));
if ($object->datenextrun && $object->datenextrun < $now) print img_warning($langs->trans("Late"));
print "</td></tr>";
print '</table>';
print '</div>';
print '<br>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
@@ -711,7 +704,7 @@ else
print '</table>';
print '</div>';
dol_fiche_end();
@@ -733,7 +726,7 @@ else
else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=execute&id='.$object->id.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).'">'.$langs->trans("CronExecute").'</a>';
}
if (! $user->rights->cron->create) {
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("CronStatusActiveBtn").'/'.$langs->trans("CronStatusInactiveBtn").'</a>';
} else {
@@ -743,7 +736,7 @@ else
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=inactive&id='.$object->id.'">'.$langs->trans("CronStatusInactiveBtn").'</a>';
}
}
if (! $user->rights->cron->delete) {
print '<a class="butActionDeleteRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</a>';
} else {

View File

@@ -30,36 +30,37 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
*/
class Cronjob extends CommonObject
{
var $element='cronjob'; //!< Id that identify managed objects
var $table_element='cronjob'; //!< Name of table without prefix where object is stored
public $element='cronjob'; //!< Id that identify managed objects
public $table_element='cronjob'; //!< Name of table without prefix where object is stored
public $picto = 'cron';
var $jobtype;
var $tms='';
var $datec='';
var $label;
var $command;
var $classesname;
var $objectname;
var $methodename;
var $params;
var $md5params;
var $module_name;
var $priority;
var $datelastrun='';
var $datenextrun='';
var $dateend='';
var $datestart='';
var $datelastresult='';
var $lastresult;
var $lastoutput;
var $unitfrequency;
var $frequency;
var $status;
var $processing;
var $fk_user_author;
var $fk_user_mod;
var $nbrun;
var $libname;
public $jobtype;
public $tms='';
public $datec='';
public $label;
public $command;
public $classesname;
public $objectname;
public $methodename;
public $params;
public $md5params;
public $module_name;
public $priority;
public $datelastrun='';
public $datenextrun='';
public $dateend='';
public $datestart='';
public $datelastresult='';
public $lastresult;
public $lastoutput;
public $unitfrequency;
public $frequency;
public $status;
public $processing;
public $fk_user_author;
public $fk_user_mod;
public $nbrun;
public $libname;
/**
@@ -1265,35 +1266,35 @@ class Cronjob extends CommonObject
class Cronjobline
{
var $id;
var $ref;
public $id;
public $ref;
var $tms='';
var $datec='';
var $label;
var $jobtype;
var $command;
var $classesname;
var $objectname;
var $methodename;
var $params;
var $md5params;
var $module_name;
var $priority;
var $datelastrun='';
var $datenextrun='';
var $dateend='';
var $datestart='';
var $lastresult='';
var $lastoutput;
var $unitfrequency;
var $frequency;
var $status;
var $fk_user_author;
var $fk_user_mod;
var $note;
var $nbrun;
var $libname;
public $tms='';
public $datec='';
public $label;
public $jobtype;
public $command;
public $classesname;
public $objectname;
public $methodename;
public $params;
public $md5params;
public $module_name;
public $priority;
public $datelastrun='';
public $datenextrun='';
public $dateend='';
public $datestart='';
public $lastresult='';
public $lastoutput;
public $unitfrequency;
public $frequency;
public $status;
public $fk_user_author;
public $fk_user_mod;
public $note;
public $nbrun;
public $libname;
/**
* Constructor

View File

@@ -50,6 +50,17 @@ $head = cron_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("CronTask"), -1, 'cron');
$linkback = '<a href="' . DOL_URL_ROOT . '/cron/list.php?status=-2">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';

View File

@@ -73,7 +73,12 @@ $ref=GETPOST('ref','alpha');
// Security check
$socid='';
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user, $origin, $origin_id);
if ($origin == 'expedition') $result=restrictedArea($user, $origin, $id);
else {
$result=restrictedArea($user, 'expedition');
if (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden();
}
$action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');

View File

@@ -41,6 +41,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AZN'
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BHD', NULL, 1, 'Bahrain');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BSD', '[36]', 1, 'Bahamas Dollar');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BBD', '[36]', 1, 'Barbados Dollar');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BDT', '[2547]', 1, 'Bangladeshi Taka');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BYR', '[112,46]', 1, 'Belarus Ruble');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BZD', '[66,90,36]', 1, 'Belize Dollar');
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'BMD', '[36]', 1, 'Bermuda Dollar');

View File

@@ -411,7 +411,7 @@ CREATE TABLE llx_blockedlog
date_object datetime,
object_data text,
fk_user integer,
entity integer DEFAULT 1,
entity integer DEFAULT 1 NOT NULL,
certified integer
) ENGINE=innodb;

View File

@@ -13,11 +13,12 @@
-- flush privileges;
-- Requests to change character set and collation of a column
-- Requests to change character set and collation of a varchar column.
-- utf8 and utf8_unicode_ci is recommended (or even better utf8mb4 and utf8mb4_unicode_ci with mysql 5.5.3+)
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
-- ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
-- You can check with "show full columns from llx_accountingaccount";
-- You can check with "show full columns from llx_accounting_account";

View File

@@ -13,7 +13,7 @@ CREATE TABLE llx_blockedlog
date_object datetime,
object_data text,
fk_user integer,
entity integer DEFAULT 1,
entity integer DEFAULT 1 NOT NULL,
certified integer
) ENGINE=innodb;

View File

@@ -0,0 +1,16 @@
Field=Field
BlockedLogDesc=This module store event for invoice and payments as block chain
FingerprintsDesc=All fingerprints stored
EntityKey=Entity Key
ShowAllFingerPrintsMightBeTooLong=Show all fingerprints (might be long)
DownloadBlockChain=Download fingerprints
KoCheckFingerprintValidity=Fingerprint is not valid
OkCheckFingerprintValidity=Fingerprint is valid
AddedByAuthority=Stored into remote authority
NotAddedByAuthorityYet=Not yet stored into remote authority
ShowDetails=Show stored details
logPAYMENT_ADD_TO_BANK=Payment added to bank
logPAYMENT_CUSTOMER_CREATE=Payment of customer created
logBILL_PAYED=Customer bill payed
logBILL_UNPAYED=Customer bill set unpayed
logBILL_VALIDATE=Customer bill set valid from draft

View File

@@ -57,9 +57,9 @@ CronStatusActiveBtn=Enable
CronStatusInactiveBtn=Disable
CronTaskInactive=This job is disabled
CronId=Id
CronClassFile=Classes (filename.class.php)
CronClassFile=Filename with class
CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module). <BR> For exemple to call the fetch method of Dolibarr Product object /htdocs/<u>product</u>/class/product.class.php, the value for module is <i>product</i>
CronClassFileHelp=The file name to load. <BR> For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/<u>product.class.php</u>, the value for class file name is <i>product.class.php</i>
CronClassFileHelp=The relative path and file name to load (path is relative to web server root directory). <BR> For exemple to call the fetch method of Dolibarr Product object htdocs/product/class/<u>product.class.php</u>, the value for class file name is <i>product/class/product.class.php</i>
CronObjectHelp=The object name to load. <BR> For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is <i>Product</i>
CronMethodHelp=The object method to launch. <BR> For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for method is <i>fecth</i>
CronArgsHelp=The method arguments. <BR> For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for paramters can be <i>0, ProductRef</i>

View File

@@ -587,7 +587,7 @@ if (! defined('NOLOGIN'))
// We are already into an authenticated session
$login=$_SESSION["dol_login"];
$entity=$_SESSION["dol_entity"];
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
$resultFetchUser=$user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1));
if ($resultFetchUser <= 0)
@@ -1083,6 +1083,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
//$ext='';
//if (! empty($conf->dol_use_jmobile)) $ext='version='.urlencode(DOL_VERSION);
$ext='version='.urlencode(DOL_VERSION);
if (GETPOST('version','int')) $ext='version='.GETPOST('version','int'); // usefull to force no cache on css/js
if (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) $ext.='&testmenuhider='.(GETPOST('testmenuhider','int')?GETPOST('testmenuhider','int'):$conf->global->MAIN_TESTMENUHIDER);

View File

@@ -29,6 +29,20 @@
*/
class ActionsMyModule
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var string Error
*/
public $error = '';
/**
* @var array Errors
*/
public $errors = array();
/**
* @var array Hook results. Propagated to $hookmanager->resArray for later reuse
*/
@@ -39,16 +53,13 @@ class ActionsMyModule
*/
public $resprints;
/**
* @var array Errors
*/
public $errors = array();
/**
* Constructor
*/
public function __construct()
public function __construct($db)
{
$this->db = $db;
}
/**

View File

@@ -84,7 +84,7 @@ class MyBox extends ModeleBoxes
*/
public function __construct(DoliDB $db, $param = '')
{
global $langs;
global $user, $conf, $langs;
$langs->load("boxes");
$langs->load('mymodule@mymodule');
@@ -93,6 +93,9 @@ class MyBox extends ModeleBoxes
$this->boxlabel = $langs->transnoentitiesnoconv("MyBox");
$this->param = $param;
//$this->enabled = $conf->global->FEATURES_LEVEL > 0; // Condition when module is enabled or not
//$this->hidden = ! ($user->rights->mymodule->myobject->read); // Condition when module is visible by user (test on permission)
}
/**

View File

@@ -1,25 +0,0 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) <year> <name of author>
*
* 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/modulebuilder/template/css/mycss.css.php
* \ingroup mymodule
* \brief CSS file for module MyModule.
*/
header('Content-Type: text/css');

View File

@@ -0,0 +1,66 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) <year> <name of author>
*
* 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/modulebuilder/template/css/mymodule.css.php
* \ingroup mymodule
* \brief CSS file for module MyModule.
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
session_cache_limiter(FALSE);
$res=0;
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php");
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php");
if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php");
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) and load permission if we need to use them in CSS
/*if (empty($user->id) && ! empty($_SESSION['dol_login']))
{
$user->fetch('',$_SESSION['dol_login']);
$user->getrights();
}*/
// Define css type
header('Content-type: text/css');
// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
// You can use CTRL+F5 to refresh your browser cache.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache');
?>
.myclasscss {
/* ... */
}

View File

@@ -160,7 +160,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
}
echo json_encode($outjson);
}
}
else
{
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
@@ -171,17 +171,21 @@ else
top_httphead();
if (empty($htmlname))
return;
{
print json_encode(array());
return;
}
$match = preg_grep('/(' . $htmlname . '[0-9]+)/', array_keys($_GET));
sort($match);
$idprod = (! empty($match[0]) ? $match[0] : '');
if (! $htmlname && (! $idprod || ! GETPOST($idprod,'alpha')))
return;
// When used from jQuery, the search term is added as GET param "term".
if (GETPOST($htmlname,'alpha') == '' && (! $idprod || ! GETPOST($idprod,'alpha')))
print json_encode(array());
return;
// When used from jQuery, the search term is added as GET param "term".
$searchkey = (($idprod && GETPOST($idprod,'alpha')) ? GETPOST($idprod,'alpha') : (GETPOST($htmlname, 'alpha') ? GETPOST($htmlname, 'alpha') : ''));
$form = new Form($db);

View File

@@ -1457,7 +1457,10 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';
@@ -1996,6 +1999,8 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
$genallowed=$user->rights->produit->creer;
$delallowed=$user->rights->produit->supprimer;
$var=true;
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles;

View File

@@ -86,8 +86,8 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
$action = 're-edit';
if ($object->error == "isFatherOfThis") {
setEventMessages($langs->trans("ErrorAssociationIsFatherOfThis"), null, 'errors');
}
else
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -204,15 +204,19 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->produit->lire || $user->rights->service->lire)
{
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 1);
if ($object->type!=Product::TYPE_SERVICE || empty($conf->global->PRODUIT_MULTIPRICES))
{
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Nature
if ($object->type!=Product::TYPE_SERVICE)
{
@@ -220,7 +224,7 @@ if ($id > 0 || ! empty($ref))
print $object->getLibFinished();
print '</td></tr>';
}
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
// Price
@@ -234,7 +238,7 @@ if ($id > 0 || ! empty($ref))
print price($object->price).' '.$langs->trans($object->price_base_type?$object->price_base_type:'HT');
}
print '</td></tr>';
// Price minimum
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
if ($object->price_base_type == 'TTC')
@@ -255,11 +259,11 @@ if ($id > 0 || ! empty($ref))
dol_fiche_end();
print '<br>';
$prodsfather = $object->getFather(); // Parent Products
$object->get_sousproduits_arbo(); // Load $object->sousprods
$prods_arbo=$object->get_arbo_each_prod();
$prods_arbo=$object->get_arbo_each_prod();
$nbofsubsubproducts=count($prods_arbo); // This include sub sub product into nb
$prodschild = $object->getChildsArbo($id,1);
$nbofsubproducts=count($prodschild); // This include only first level of childs
@@ -368,7 +372,7 @@ if ($id > 0 || ! empty($ref))
$totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise), 'MT');
$total+=$totalline;
print '<td align="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency));
print '</td>';
@@ -384,7 +388,7 @@ if ($id > 0 || ! empty($ref))
print '<td align="right" colspan="2">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($pricesell,'','',0,0,-1,$conf->currency));
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td align="right">'.$value['stock'].'</td>'; // Real stock
@@ -423,7 +427,7 @@ if ($id > 0 || ! empty($ref))
// Best selling price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
print '<td align="center">'.$value['nb'].'</td>';
print '<td>&nbsp;</td>';
@@ -455,7 +459,7 @@ if ($id > 0 || ! empty($ref))
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($totalsell,'','',0,0,-1,$conf->currency));
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right">&nbsp;</td>';
@@ -570,7 +574,7 @@ if ($id > 0 || ! empty($ref))
continue;
}
}
print "\n<tr ".$bc[$var].">";
$productstatic->id=$objp->rowid;
$productstatic->ref=$objp->ref;

View File

@@ -214,7 +214,11 @@ if ($object->id)
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -310,7 +310,11 @@ if ($id > 0 || $ref)
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -342,12 +342,12 @@ if ($result)
else print price($objp->price).' '.$langs->trans("HT");
print '</td>';
}
print '<td align="right" class="nowrap">';
print '<td align="right" class="nowrap"><span class="statusrefsell">';
print $product_static->LibStatut($objp->tosell,3,0);
print "</td>";
print '<td align="right" class="nowrap">';
print "</span></td>";
print '<td align="right" class="nowrap"><span class="statusrefbuy">';
print $product_static->LibStatut($objp->tobuy,3,1);
print "</td>";
print "</span></td>";
print "</tr>\n";
$i++;
}

View File

@@ -87,17 +87,21 @@ if ($id > 0 || $ref)
exit;
}
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'info', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
$object->info($object->id);
print '<div class="fichecenter">';
@@ -105,11 +109,11 @@ if ($id > 0 || $ref)
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
print '</div>';
dol_fiche_end();
}

View File

@@ -90,21 +90,25 @@ if ($id > 0 || ! empty($ref))
$head = product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type==Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'note', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
$cssclass='titlefield';
//if ($action == 'editnote_public') $cssclass='titlefieldcreate';
//if ($action == 'editnote_private') $cssclass='titlefieldcreate';
//print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end();

View File

@@ -90,9 +90,9 @@ if (empty($reshook))
{
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_soc = '';
$search_soc = '';
}
if ($action == 'setlabelsellingprice' && $user->admin)
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
@@ -100,7 +100,7 @@ if (empty($reshook))
dolibarr_set_const($db, $keyforlabel, GETPOST('labelsellingprice','alpha'), 'chaine', 0, '', $conf->entity);
$action = '';
}
if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
{
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
@@ -149,14 +149,14 @@ if (empty($reshook))
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
if ($error)
{
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
$localtaxarray=array(); // We do not store localtaxes into product, we will use instead the "vat code" to retreive them.
$object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
}
if (! $error)
{
$db->commit();
@@ -165,10 +165,10 @@ if (empty($reshook))
{
$db->rollback();
}
$action='';
}
if (($action == 'update_price') && !$cancel && $object->getRights()->creer)
{
$error = 0;
@@ -208,14 +208,14 @@ if (empty($reshook))
//Shall we generate prices using price rules?
$object->price_autogen = GETPOST('usePriceRules') == 'on';
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
if (!isset($newprice[$i])) {
continue;
}
$tva_tx_txt = $newvattx[$i];
$vatratecode = '';
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
@@ -242,7 +242,7 @@ if (empty($reshook))
$localtax2 = $obj->localtax2;
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}
}
}
$pricestoupdate[$i] = array(
@@ -469,7 +469,7 @@ if (empty($reshook))
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
$tva_tx_txt = GETPOST("tva_tx");
$vatratecode = '';
// We must define tva_tx, npr and local taxes
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
@@ -496,8 +496,8 @@ if (empty($reshook))
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
}
}
}
$prodcustprice->default_vat_code = $vatratecode;
$prodcustprice->tva_tx = $tva_tx;
$prodcustprice->recuperableonly = $npr;
@@ -505,7 +505,7 @@ if (empty($reshook))
$prodcustprice->localtax2_tx = $localtax2;
$prodcustprice->localtax1_type = $localtax1_type;
$prodcustprice->localtax2_type = $localtax2_type;
if (! ($prodcustprice->fk_soc > 0))
{
$langs->load("errors");
@@ -591,7 +591,7 @@ if (empty($reshook))
$localtax2_type = $obj->localtax2_type;
}
}
$prodcustprice->default_vat_code = $vatratecode;
$prodcustprice->tva_tx = $tva_tx;
$prodcustprice->recuperableonly = $npr;
@@ -599,7 +599,7 @@ if (empty($reshook))
$prodcustprice->localtax2_tx = $localtax2;
$prodcustprice->localtax1_type = $localtax1_type;
$prodcustprice->localtax2_type = $localtax2_type;
if ($prodcustprice->price_min < $maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
{
setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
@@ -659,7 +659,11 @@ dol_fiche_head($head, 'price', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter=" fk_product_type = ".$object->type;
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';
@@ -703,7 +707,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print price($object->multiprices_min[$soc->price_level]) . ' ' . $langs->trans(empty($object->multiprices_base_type[$soc->price_level])?'HT':$object->multiprices_base_type[$soc->price_level]);
}
print '</td></tr>';
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
{
// TVA
@@ -720,7 +724,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);
print '</td></tr>';
}
}
else
{
@@ -743,9 +747,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '</td></tr>';
}
print '</table>';
print '<br>';
print '<table class="noborder tableforfield" width="100%">';
print '<tr class="liste_titre"><td>';
print $langs->trans("PriceLevel");
@@ -756,11 +760,11 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '</tr>';
$var=True;
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
{
$var = ! $var;
print '<tr class="oddeven">';
// Label of price
@@ -825,7 +829,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '<td align="right">' . $langs->trans("Discount") . '</td>';
print '<td>&nbsp;</td>';
print '</tr>';
foreach ($object->prices_by_qty_list[$i] as $ii => $prices)
foreach ($object->prices_by_qty_list[$i] as $ii => $prices)
{
if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
@@ -883,15 +887,15 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
}
}
}
}
else
}
else
{
// TVA
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>';
if ($object->default_vat_code)
{
print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
}
}
else print vatrate($object->tva_tx, true, $object->tva_npr, true);
print '</td></tr>';
@@ -1022,18 +1026,18 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&amp;id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
}
}
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&amp;id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
}
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&amp;id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
}
}
print "\n</div>\n";
}
@@ -1042,7 +1046,7 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
/*
* Edit price area
*/
if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->service->creer))
{
print load_fiche_titre($langs->trans("UpdateVAT"), '');
@@ -1053,9 +1057,9 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
print '<input type="hidden" name="id" value="' . $object->id . '">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// VAT
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
@@ -1073,7 +1077,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
print '<br></form><br>';
}
if ($action == 'edit_price' && $object->getRights()->creer)
{
print load_fiche_titre($langs->trans("NewPrice"), '');
@@ -1087,7 +1091,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
print '<input type="hidden" name="id" value="' . $object->id . '">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// VAT
@@ -1170,7 +1174,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
}
print '</td>';
print '</tr>';
print '</table>';
dol_fiche_end();
@@ -1216,21 +1220,21 @@ if ($action == 'edit_price' && $object->getRights()->creer)
print '<input type="hidden" name="id" value="' . $object->id . '">';
//dol_fiche_head('', '', '', -1);
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) {
print $langs->trans('UseMultipriceRules'). ' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
}
print '<table class="noborder">';
print '<thead><tr class="liste_titre">';
print '<td>'.$langs->trans("PriceLevel").'</td>';
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) print '<td style="text-align: center">'.$langs->trans("VATRate").'</td>';
else print '<td></td>';
print '<td class="center">'.$langs->trans("SellingPrice").'</td>';
print '<td class="center">'.$langs->trans("MinPrice").'</td>';
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) {
@@ -1239,9 +1243,9 @@ if ($action == 'edit_price' && $object->getRights()->creer)
print '</tr></thead>';
print '<tbody>';
$var = false;
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
{
$var = !$var;
@@ -1294,11 +1298,11 @@ if ($action == 'edit_price' && $object->getRights()->creer)
}
print '</tbody>';
print '</table>';
//dol_fiche_end();
print '<div style="text-align: center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;';
@@ -1324,48 +1328,48 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level;
$sql .= " ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
// $sql .= $db->plimit();
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if (! $num)
{
$db->free($result);
// Il doit au moins y avoir la ligne de prix initial.
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
$object->updatePrice($object->price, $object->price_base_type, $user, $newprice_min);
$result = $db->query($sql);
$num = $db->num_rows($result);
}
if ($num > 0)
{
// Default prices or
// Log of previous customer prices
$backbutton='<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Back") . '</a>';
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, $num, $num, 'title_accountancy.png');
else print_barre_liste($langs->trans("PriceByCustomerLog"), 0, $_SERVER["PHP_SELF"], '', '', '', '', $num, $num, 'title_accountancy.png');
//if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png');
//else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png');
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
print '<td align="center">' . $langs->trans("PriceLevel") . '</td>';
}
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
print '<td align="center">' . $langs->trans("Type") . '</td>';
}
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
print $conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL;
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">' . $langs->trans("VATRate") . '</td>';
@@ -1380,9 +1384,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
if ($user->rights->produit->supprimer)
print '<td align="right">&nbsp;</td>';
print '</tr>';
$notfirstlineforlevel=array();
$var = True;
$i = 0;
while ($i < $num)
@@ -1392,7 +1396,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
print '<tr '. $bc[$var].'>';
// Date
print "<td>" . dol_print_date($db->jdate($objp->dp), "dayhour") . "</td>";
// Price level
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
print '<td align="center">' . $objp->price_level . "</td>";
@@ -1403,9 +1407,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
$type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard';
print '<td align="center">' . $langs->trans($type) . "</td>";
}
print '<td align="center">' . $langs->trans($objp->price_base_type) . "</td>";
if (empty($conf->global->PRODUIT_MULTIPRICES))
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
print '<td align="right">';
if ($objp->default_vat_code)
@@ -1415,7 +1419,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
else print vatrate($objp->tva_tx, true, $objp->recuperableonly);
print "</td>";
}
// Price
if (! empty($objp->fk_price_expression) && ! empty($conf->dynamicprices->enabled))
{
@@ -1436,23 +1440,23 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
}
print '<td align="right">' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '</td>';
print '<td align="right">' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '</td>';
// User
print '<td align="right"><a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $objp->user_id . '">' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '</a></td>';
// Action
if ($user->rights->produit->supprimer)
{
$candelete=0;
if (! empty($conf->global->PRODUIT_MULTIPRICES))
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
if (empty($notfirstlineforlevel[$objp->price_level])) $notfirstlineforlevel[$objp->price_level]=1;
else $candelete=1;
}
elseif ($i > 0) $candelete=1;
print '<td align="right">';
if ($candelete)
if ($candelete)
{
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&amp;id=' . $object->id . '&amp;lineid=' . $objp->rowid . '">';
print img_delete();
@@ -1461,11 +1465,11 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
print '&nbsp;'; // Can not delete last price (it's current price)
print '</td>';
}
print "</tr>\n";
$i++;
}
$db->free($result);
print "</table>";
print '</div>';
@@ -1514,9 +1518,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="add_customer_price_confirm">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
dol_fiche_head();
print '<table class="border" width="100%">';
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans('ThirdParty') . '</td>';
@@ -1578,7 +1582,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@@ -1615,7 +1619,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1);
print '</td></tr>';
// Price base
print '<tr><td width="15%">';
print $langs->trans('PriceBase');
@@ -1692,12 +1696,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$staticsoc = new Societe($db);
$staticsoc->fetch(GETPOST('socid', 'int'));
$title=$langs->trans('PriceByCustomerLog');
$title.=' - '.$staticsoc->getNomUrl(1);
$backbutton='<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Back") . '</a>';
print_barre_liste($title, $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, $backbutton, count($prodcustprice->lines), $nbtotalofrecords, 'title_accountancy.png');
if (count($prodcustprice->lines) > 0)
@@ -1735,7 +1739,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
print '<td align="right">' . price($line->price) . "</td>";
@@ -1759,7 +1763,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
// List of all prices by customers
print '<!-- list of prices per customer -->'."\n";
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@@ -1805,15 +1809,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '</td>';
print '</tr>';
}
$var = False;
// Line for default price
print '<tr class="oddeven">';
print "<td>" . $langs->trans("Default") . "</td>";
print "<td>" . "</td>";
print '<td align="center">' . $langs->trans($object->price_base_type) . "</td>";
print '<td align="right">' . vatrate($object->tva_tx, true, $object->recuperableonly) . "</td>";
print '<td align="right">' . price($object->price) . "</td>";
@@ -1837,21 +1841,22 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
}
print "</tr>\n";
if (count($prodcustprice->lines) > 0)
{
$var = false;
foreach ($prodcustprice->lines as $line)
{
$var = ! $var;
print '<tr class="oddeven">';
// Date
$staticsoc = new Societe($db);
$staticsoc->fetch($line->fk_soc);
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";

View File

@@ -139,7 +139,7 @@ if ($result && (! empty($id) || ! empty($ref)))
dol_fiche_head($head, 'stats', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
dol_fiche_end();
@@ -173,50 +173,50 @@ if (empty($id) & empty($ref))
if ($result || empty($id))
{
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="id" value="'.$id.'">';
if (empty($id))
{
// Type
print '<tr><td class="titlefield">'.$langs->trans("ProductsAndServices").'</td><td>';
$array=array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
print $form->selectarray('type', $array, $type);
print '</td></tr>';
// Tag
if ($conf->categorie->enabled)
{
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
//$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1);
//$moreforfilter.='</div>';
print $moreforfilter;
print '</td></tr>';
}
}
// Year
print '<tr><td class="titlefield">'.$langs->trans("Year").'</td><td>';
$arrayyears=array();
for ($year = $currentyear - 10; $year < $currentyear + 10 ; $year++)
{
$arrayyears[$year]=$year;
}
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('search_year',$arrayyears,$search_year,0);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
if (empty($id))
{
// Type
print '<tr><td class="titlefield">'.$langs->trans("ProductsAndServices").'</td><td>';
$array=array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
print $form->selectarray('type', $array, $type);
print '</td></tr>';
print '</table>';
print '<div class="center"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
print '<br>';
// Tag
if ($conf->categorie->enabled)
{
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
//$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1);
//$moreforfilter.='</div>';
print $moreforfilter;
print '</td></tr>';
}
}
// Year
print '<tr><td class="titlefield">'.$langs->trans("Year").'</td><td>';
$arrayyears=array();
for ($year = $currentyear - 10; $year < $currentyear + 10 ; $year++)
{
$arrayyears[$year]=$year;
}
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
arsort($arrayyears);
print $form->selectarray('search_year',$arrayyears,$search_year,0);
print '</td></tr>';
print '</table>';
print '<div class="center"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
print '<br>';
// Choice of stats mode (byunit or bynumber)
if (! empty($conf->dol_use_jmobile)) print "\n".'<div class="fichecenter"><div class="nowrap">'."\n";
@@ -308,7 +308,7 @@ if ($result || empty($id))
else
{
$morefilters='';
if ($search_categ > 0)
if ($search_categ > 0)
{
$categ=new Categorie($db);
$categ->fetch($search_categ);
@@ -319,7 +319,7 @@ if ($result || empty($id))
{
$morefilters=' AND d.fk_product NOT IN (SELECT cp.fk_product from '.MAIN_DB_PREFIX.'categorie_product as cp)';
}
if ($key == 'propal') $graph_data = $object->get_nb_propal($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
if ($key == 'orders') $graph_data = $object->get_nb_order($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
if ($key == 'invoices') $graph_data = $object->get_nb_vente($socid, $mode, ((string) $type != '' ? $type : -1), $search_year, $morefilters);
@@ -394,7 +394,7 @@ if ($result || empty($id))
print $dategenerated=($mesg?'<font class="error">'.$mesg.'</font>':$langs->trans("ChartNotGenerated"));
}
$linktoregenerate='<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'&search_year='.$search_year.'&search_categ='.$search_categ.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')','refresh').'</a>';
// Show graph
print '<table class="noborder" width="100%">';
// Label

View File

@@ -102,7 +102,10 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -109,7 +109,10 @@ if ($id > 0 || ! empty($ref)) {
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -92,7 +92,10 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -119,7 +119,10 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -104,7 +104,10 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -102,7 +102,10 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';

View File

@@ -100,7 +100,7 @@ if ($action == 'add' && $user->rights->stock->creer)
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
else
{
setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
$action="create"; // Force retour sur page creation
@@ -194,7 +194,7 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value=""></td></tr>';
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.(!empty($object->lieu)?$object->lieu:'').'"></td></tr>';
// Parent entrepot
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $formproduct->selectWarehouses('', 'fk_parent', '', 1);
@@ -276,7 +276,7 @@ else
dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
$formconfirm = '';
// Confirm delete third party
if ($action == 'delete')
{
@@ -300,7 +300,10 @@ else
$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref);
$shownav = 1;
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
@@ -315,7 +318,7 @@ else
print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>';
print $e->getNomUrl(3);
print '</td></tr>';
}
// Description

View File

@@ -54,9 +54,12 @@ $morehtmlref='<div class="refidno">';
$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref);
$shownav = 1;
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@@ -105,7 +105,7 @@ $arrayfields=array(
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
);
$object = new MouvementStock($db); // To be passed as parameter of executeHooks that need
$object = new MouvementStock($db); // To be passed as parameter of executeHooks that need
/*
@@ -164,13 +164,13 @@ if ($action == "correct_stock")
{
$origin_element = '';
$origin_id = null;
if (GETPOST('projectid', 'int'))
{
$origin_element = 'project';
$origin_id = GETPOST('projectid', 'int');
}
if ($product->hasbatch())
{
$batch=GETPOST('batch_number');
@@ -179,7 +179,7 @@ if ($action == "correct_stock")
//$sellby=GETPOST('sellby');
$eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
$sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
$result=$product->correct_stock_batch(
$user,
$id,
@@ -229,7 +229,7 @@ if ($action == "transfert_stock" && ! $cancel)
{
$product = new Product($db);
if (! empty($product_id)) $result=$product->fetch($product_id);
if (! (GETPOST("id_entrepot_destination",'int') > 0))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
@@ -283,7 +283,7 @@ if ($action == "transfert_stock" && ! $cancel)
$pricesrc=0;
if (isset($product->pmp)) $pricesrc=$product->pmp;
$pricedest=$pricesrc;
if ($product->hasbatch())
{
$pdluo = new Productbatch($db);
@@ -509,8 +509,8 @@ if ($resql)
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
$i = 0;
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
if ($msid) $texte = $langs->trans('StockMovementForId', $msid);
@@ -530,20 +530,23 @@ if ($resql)
dol_fiche_head($head, 'movements', $langs->trans("Warehouse"), 0, 'stock');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
$morehtmlref.='</div>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref);
$shownav = 1;
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Description
@@ -564,14 +567,14 @@ if ($resql)
print "</td></tr>";
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Value
print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency);
@@ -608,9 +611,9 @@ if ($resql)
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
}
@@ -653,10 +656,10 @@ if ($resql)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert">'.$langs->trans("StockTransfer").'</a>';
}
print '</div><br>';
}
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
@@ -687,7 +690,7 @@ if ($resql)
//if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -699,23 +702,23 @@ if ($resql)
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, '', 0, '', '', $limit);
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
$moreforfilter='';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -725,20 +728,20 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Lignes des champs de filtre
print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['m.rowid']['checked']))
if (! empty($arrayfields['m.rowid']['checked']))
{
// Ref
print '<td class="liste_titre" align="left">';
print '<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
if (! empty($arrayfields['m.datem']['checked']))
if (! empty($arrayfields['m.datem']['checked']))
{
print '<td class="liste_titre" valign="right">';
print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">';
@@ -749,14 +752,14 @@ if ($resql)
//print $formother->selectyear($syear,'year',1, 20, 5);
print '</td>';
}
if (! empty($arrayfields['p.ref']['checked']))
if (! empty($arrayfields['p.ref']['checked']))
{
// Product Ref
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_product_ref" value="'.dol_escape_htmltag($idproduct?$product->ref:$search_product_ref).'">';
print '</td>';
}
if (! empty($arrayfields['p.label']['checked']))
if (! empty($arrayfields['p.label']['checked']))
{
// Product label
print '<td class="liste_titre" align="left">';
@@ -764,14 +767,14 @@ if ($resql)
print '</td>';
}
// Batch
if (! empty($arrayfields['m.batch']['checked']))
if (! empty($arrayfields['m.batch']['checked']))
{
print '<td class="liste_titre" align="center"><input class="flat" type="text" size="5" name="search_batch" value="'.dol_escape_htmltag($search_batch).'"></td>';
}
if (! empty($arrayfields['pl.eatby']['checked']))
{
print '<td class="liste_titre" align="left">';
print '</td>';
print '</td>';
}
if (! empty($arrayfields['pl.sellby']['checked']))
{
@@ -779,42 +782,42 @@ if ($resql)
print '</td>';
}
// Warehouse
if (! empty($arrayfields['e.label']['checked']))
if (! empty($arrayfields['e.label']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
//print '<input class="flat" type="text" size="8" name="search_warehouse" value="'.($search_warehouse).'">';
print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print '</td>';
}
if (! empty($arrayfields['m.fk_user_author']['checked']))
if (! empty($arrayfields['m.fk_user_author']['checked']))
{
// Author
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
print '</td>';
}
if (! empty($arrayfields['m.inventorycode']['checked']))
if (! empty($arrayfields['m.inventorycode']['checked']))
{
// Inventory code
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).'">';
print '</td>';
}
if (! empty($arrayfields['m.label']['checked']))
if (! empty($arrayfields['m.label']['checked']))
{
// Label of movement
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).'">';
print '</td>';
}
if (! empty($arrayfields['origin']['checked']))
if (! empty($arrayfields['origin']['checked']))
{
// Origin of movement
print '<td class="liste_titre" align="left">';
print '&nbsp; ';
print '</td>';
}
if (! empty($arrayfields['m.value']['checked']))
if (! empty($arrayfields['m.value']['checked']))
{
// Qty
print '<td class="liste_titre" align="right">';
@@ -860,7 +863,7 @@ if ($resql)
print '<td class="liste_titre">';
print '</td>';
}
// Actions
// Actions
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
@@ -884,9 +887,9 @@ if ($resql)
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
@@ -914,16 +917,16 @@ if ($resql)
$productstatic->label=$objp->produit;
$productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
$productlot->id = $objp->lotid;
$productlot->batch= $objp->batch;
$productlot->eatby= $objp->eatby;
$productlot->sellby= $objp->sellby;
$warehousestatic->id=$objp->entrepot_id;
$warehousestatic->libelle=$objp->stock;
$warehousestatic->lieu=$objp->lieu;
$arrayofuniqueproduct[$objp->rowid]=$objp->produit;
if(!empty($objp->fk_origin)) {
$origin = $movement->get_origin($objp->fk_origin, $objp->origintype);
@@ -1027,7 +1030,7 @@ if ($resql)
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
@@ -1041,7 +1044,7 @@ if ($resql)
if (count($arrayofuniqueproduct) == 1 && is_numeric($year))
{
print "<br>";
$productidselected=0;
foreach ($arrayofuniqueproduct as $key => $val)
{

View File

@@ -545,7 +545,10 @@ if ($id > 0 || $ref)
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
$shownav = 1;
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
print '<div class="fichecenter">';
@@ -961,7 +964,6 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
print '<td align="right">'.$line['desiredstock'].'</td>';
print '<td align="right"><a href="?id='.GETPOST('id').'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
print '</tr>';
}
}

View File

@@ -112,21 +112,21 @@ if (empty($reshook))
$result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) dol_print_error($db, $object->error);
}
if ($action == 'setsellby' && $user->rights->stock->creer)
{
$newvalue=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
if ($result < 0) dol_print_error($db, $object->error);
}
if ($action == 'update_extras')
{
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
if (! $error)
{
// Actions on extra fields (by external module or standard code)
@@ -142,11 +142,11 @@ if (empty($reshook))
} else if ($reshook < 0)
$error++;
}
if ($error)
$action = 'edit_extras';
}
// Action to add record
if ($action == 'add')
{
@@ -160,7 +160,7 @@ if (empty($reshook))
$error=0;
/* object_prop_getpost_prop */
$object->entity=GETPOST('entity','int');
$object->fk_product=GETPOST('fk_product','int');
$object->batch=GETPOST('batch','alpha');
@@ -204,7 +204,7 @@ if (empty($reshook))
if ($action == 'update' && ! GETPOST('cancel'))
{
$error=0;
$object->entity=GETPOST('entity','int');
$object->fk_product=GETPOST('fk_product','int');
$object->batch=GETPOST('batch','alpha');
@@ -283,7 +283,7 @@ if ($action == 'create')
print '<table class="border centpercent">'."\n";
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
//
//
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldentity").'</td><td><input class="flat" type="text" name="entity" value="'.GETPOST('entity').'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_product").'</td><td><input class="flat" type="text" name="fk_product" value="'.GETPOST('fk_product').'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldbatch").'</td><td><input class="flat" type="text" name="batch" value="'.GETPOST('batch').'"></td></tr>';
@@ -305,28 +305,31 @@ if ($action == 'create')
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
$res = $object->fetch_optionals($object->id, $extralabels);
//print load_fiche_titre($langs->trans("Batch"));
$head = productlot_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("Batch"), 0, 'barcode');
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
$linkback = '<a href="' . DOL_URL_ROOT . '/product/stock/productlot_list.php' . '">' . $langs->trans("BackToList") . '</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'batch');
$shownav = 1;
if ($user->societe_id && ! in_array('batch', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'."\n";
// Product
print '<tr><td class="titlefield">'.$langs->trans("Product").'</td><td>';
$producttmp = new Product($db);
@@ -341,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '</tr>';
// Sell by
print '<tr><td>';
print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
@@ -349,15 +352,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
print '</td>';
print '</tr>';
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
dol_fiche_end();
@@ -381,8 +384,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
*/
}
print '</div>'."\n";
print '<a href="'.DOL_URL_ROOT.'/product/reassortlot.php?sref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.$langs->trans("ShowCurrentStockOfLot").'</a><br>';
print '<br>';
print '<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?search_product_ref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.$langs->trans("ShowLogOfMovementIfLot").'</a><br>';

View File

@@ -202,7 +202,10 @@ dol_fiche_head($head, 'translation', $titre, 0, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', '', '', 0, '', '', 1);
$shownav = 1;
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
dol_banner_tab($object, 'ref', $linkback, shownav, 'ref');
dol_fiche_end();
@@ -245,7 +248,7 @@ if ($action == 'edit')
{
$s=picto_from_langcode($key);
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
@@ -265,7 +268,7 @@ if ($action == 'edit')
}
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@@ -283,7 +286,7 @@ else if ($action != 'add')
{
$s=picto_from_langcode($key);
print ($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
@@ -318,7 +321,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print '<input type="hidden" name="id" value="'.GETPOST("id",'int').'">';
dol_fiche_head();
print '<table class="border" width="100%">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
print $formadmin->select_language('','forcelangprod',0,$object->multilangs,1);
@@ -339,7 +342,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';