Merge branch 'develop' into develop_advtargetemailiing
This commit is contained in:
commit
867dbc766e
@ -131,7 +131,10 @@ print '</tr>';
|
||||
// Bon de livraison activation/desactivation
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("DeliveriesOrderAbility").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("DeliveriesOrderAbility");
|
||||
print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
|
||||
print '</td>';
|
||||
print '<td align="center" width="20">';
|
||||
print '</td>';
|
||||
print '<td align="center" width="100">';
|
||||
@ -151,7 +154,5 @@ print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print info_admin($langs->trans("NoNeedForDeliveryReceipts"));
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
|
||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.ranges, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
||||
@ -644,7 +644,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
@ -1064,7 +1064,7 @@ if ($id)
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
||||
@ -1407,7 +1407,7 @@ if ($id)
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
||||
$canbemodified=$iserasable;
|
||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
||||
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
|
||||
// Favorite
|
||||
|
||||
@ -521,9 +521,9 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
$period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1);
|
||||
$period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,0,1);
|
||||
$period_filter .= ' ';
|
||||
$period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1);
|
||||
$period_filter .= $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,0,1);
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$period_filter.'</td>';
|
||||
|
||||
@ -64,7 +64,7 @@ class FormAccounting
|
||||
|
||||
if (! empty($mysoc->country_id))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.label as type, c.range";
|
||||
$sql = "SELECT c.rowid, c.label as type, c.ranges";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||
@ -72,14 +72,14 @@ class FormAccounting
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.label as type, c.range";
|
||||
$sql = "SELECT c.rowid, c.label as type, c.ranges";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.label ASC";
|
||||
}
|
||||
|
||||
dol_syslog("Form::select_accounting_category", LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -96,7 +96,7 @@ class FormAccounting
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
if ($obj->rowid == $selected) print ' selected';
|
||||
print '>'.dol_trunc($obj->type,$maxlen);
|
||||
print ' ('.$obj->range.')';
|
||||
print ' ('.$obj->ranges.')';
|
||||
$i++;
|
||||
}
|
||||
print '</select>';
|
||||
|
||||
@ -150,6 +150,7 @@ if (empty($reshook))
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
// Create shipment
|
||||
if ($action == 'add' && $user->rights->expedition->creer)
|
||||
{
|
||||
$error=0;
|
||||
@ -251,7 +252,7 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
//var_dump($_POST); var_dump($batch);
|
||||
//var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit;
|
||||
//shipment line for product with no batch management and no multiple stock location
|
||||
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
|
||||
}
|
||||
@ -283,7 +284,8 @@ if (empty($reshook))
|
||||
if (isset($stockLine[$i]))
|
||||
{
|
||||
//shipment from multiple stock locations
|
||||
for($j = 0; $j < count($stockLine[$i]); $j++)
|
||||
$nbstockline = count($stockLine[$i]);
|
||||
for($j = 0; $j < $nbstockline; $j++)
|
||||
{
|
||||
if ($stockLine[$i][$j]['qty']>0)
|
||||
{
|
||||
@ -606,7 +608,7 @@ if ($action == 'create')
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%" class="fieldrequired">';
|
||||
print '<tr><td class="fieldrequired">';
|
||||
if ($origin == 'commande' && ! empty($conf->commande->enabled))
|
||||
{
|
||||
print $langs->trans("RefOrder").'</td><td colspan="3"><a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref;
|
||||
@ -710,17 +712,21 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Document model
|
||||
print "<tr><td>".$langs->trans("Model")."</td>";
|
||||
print '<td colspan="3">';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';
|
||||
$liste = ModelePdfExpedition::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if (count($liste) > 1)
|
||||
{
|
||||
print "<tr><td>".$langs->trans("Model")."</td>";
|
||||
print '<td colspan="3">';
|
||||
print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Shipment lines
|
||||
|
||||
$numAsked = count($object->lines);
|
||||
@ -873,8 +879,9 @@ if ($action == 'create')
|
||||
$warehouse_id = GETPOST('entrepot_id','int');
|
||||
|
||||
$warehouseObject = null;
|
||||
if ($warehouse_id > 0 || ! ($line->fk_product > 0)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
|
||||
if ($warehouse_id > 0 || ! ($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
|
||||
{
|
||||
print '<!-- Case warehouse already known or product not a predefined product -->';
|
||||
//ship from preselected location
|
||||
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number
|
||||
$deliverableQty=min($quantityToBeDelivered, $stock);
|
||||
@ -903,7 +910,8 @@ if ($action == 'create')
|
||||
$tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):$warehouse_id;
|
||||
if ($line->fk_product > 0)
|
||||
{
|
||||
print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||
print '<!-- Show warehouse selection -->';
|
||||
print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1);
|
||||
if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id)
|
||||
{
|
||||
//print $stock.' '.$quantityToBeDelivered;
|
||||
@ -984,7 +992,8 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<!-- Case -->';
|
||||
print '<tr><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
|
||||
print '</td>';
|
||||
|
||||
@ -1000,10 +1009,11 @@ if ($action == 'create')
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
|
||||
{
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
|
||||
|
||||
print '<!-- Case warehouse not already known and product does not need lot -->';
|
||||
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
$subj=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
@ -1049,7 +1059,7 @@ if ($action == 'create')
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
// Show subproducts of product
|
||||
// Show subproducts of product (not recommanded)
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
|
||||
{
|
||||
$product->get_sousproduits_arbo();
|
||||
@ -1116,7 +1126,8 @@ if ($action == 'create')
|
||||
}
|
||||
if ($subj == 0) // Line not shown yet, we show it
|
||||
{
|
||||
print '<tr><td colspan="3" ></td><td align="center"><!-- line not shown yet, we show it -->';
|
||||
print '<!-- line not shown yet, we show it -->';
|
||||
print '<tr><td colspan="3" ></td><td align="center">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
//$disabled='disabled="disabled"';
|
||||
@ -1152,7 +1163,8 @@ if ($action == 'create')
|
||||
|
||||
|
||||
//Display lines extrafields
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0)
|
||||
{
|
||||
$colspan=5;
|
||||
$line = new ExpeditionLigne($db);
|
||||
$line->fetch_optionals($object->id,$extralabelslines);
|
||||
|
||||
@ -335,7 +335,7 @@ CREATE TABLE llx_c_accounting_category (
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
range varchar(255) NOT NULL,
|
||||
ranges varchar(255) NOT NULL,
|
||||
position integer DEFAULT 0,
|
||||
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
||||
active integer DEFAULT 1
|
||||
|
||||
@ -21,7 +21,7 @@ CREATE TABLE llx_c_accounting_category (
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
range varchar(255) NOT NULL,
|
||||
ranges varchar(255) NOT NULL,
|
||||
position integer DEFAULT 0,
|
||||
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
||||
active integer DEFAULT 1
|
||||
|
||||
@ -171,6 +171,7 @@ PredefinedProductsAndServicesToSell=Predefined products/services to sell
|
||||
PredefinedProductsToPurchase=Predefined product to purchase
|
||||
PredefinedServicesToPurchase=Predefined services to purchase
|
||||
PredefinedProductsAndServicesToPurchase=Predefined products/services to puchase
|
||||
NotPredefinedProducts=Not predefined products/services
|
||||
GenerateThumb=Generate thumb
|
||||
ProductCanvasAbility=Use special "canvas" addons
|
||||
ServiceNb=Service #%s
|
||||
|
||||
@ -165,16 +165,15 @@ print '</form>';
|
||||
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
|
||||
if ($id > 0) $sql.= " d.fk_product,";
|
||||
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
|
||||
$sql.= " SUM(d.total_ht) as selling_price,";
|
||||
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND d.fk_product = p.rowid";
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($id > 0)
|
||||
@ -186,8 +185,8 @@ if (!empty($enddate))
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
|
||||
else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref";
|
||||
if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
|
||||
else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity";
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
@ -260,13 +259,20 @@ if ($result)
|
||||
}
|
||||
else {
|
||||
print '<td>';
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->id=$objp->rowid;
|
||||
$product_static->ref=$objp->ref;
|
||||
$product_static->label=$objp->label;
|
||||
$product_static->entity=$objp->pentity;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
print $text.= ' - '.$objp->label;
|
||||
if ($objp->rowid > 0)
|
||||
{
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->id=$objp->rowid;
|
||||
$product_static->ref=$objp->ref;
|
||||
$product_static->label=$objp->label;
|
||||
$product_static->entity=$objp->pentity;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
print $text.= ' - '.$objp->label;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NotPredefinedProducts");
|
||||
}
|
||||
print "</td>\n";
|
||||
//print "<td>".$product_static->getNomUrl(1)."</td>\n";
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ class FormProduct
|
||||
if ($selected == $id || ($selected == 'ifone' && $nbofwarehouses == 1)) $out.=' selected';
|
||||
$out.='>';
|
||||
$out.=$arraytypes['label'];
|
||||
if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0)) $out.='('.$langs->trans("Stock").':'.$arraytypes['stock'].')';
|
||||
if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0 || ($showstock > 0))) $out.=' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')';
|
||||
$out.='</option>';
|
||||
}
|
||||
$out.='</select>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user