Merge branch '6.0' of https://github.com/Dolibarr/dolibarr into 6.0-api

This commit is contained in:
Neil Orley
2017-09-22 11:58:37 +02:00
11 changed files with 57 additions and 13 deletions

View File

@@ -1356,6 +1356,7 @@ if (empty($reshook))
{
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fetch_optionals($line->id);
}
}
@@ -1377,7 +1378,21 @@ if (empty($reshook))
$object->situation_counter = $object->situation_counter + 1;
$id = $object->createFromCurrent($user);
if ($id <= 0) $mesg = $object->error;
if ($id <= 0)
{
$mesg = $object->error;
}
else
{
$nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id);
// create extrafields with data from create form
$extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice);
if ($ret > 0) {
$nextSituationInvoice->insertExtraFields();
}
}
}
}

View File

@@ -3274,7 +3274,7 @@ class Form
$return= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
$sql = 'SELECT rowid, label from '.MAIN_DB_PREFIX.'c_units';
$sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units';
$sql.= ' WHERE active > 0';
$resql = $this->db->query($sql);

View File

@@ -780,9 +780,15 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit');
}
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
// copy from order
$orderExtrafields = new Extrafields($db);
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
if ($object->fetch_optionals($object->id, $orderExtrafieldLabels) > 0) {
$expe->array_options = array_merge($expe->array_options, $object->array_options);
}
print $object->showOptionals($extrafields, 'edit');
}
// Incoterms
@@ -1304,8 +1310,13 @@ if ($action == 'create')
if (is_array($extralabelslines) && count($extralabelslines)>0)
{
$colspan=5;
$orderLineExtrafields = new Extrafields($db);
$orderLineExtrafieldLabels = $orderLineExtrafields->fetch_name_optionals_label($object->table_element_line);
$srcLine = new OrderLine($db);
$srcLine->fetch_optionals($line->id,$orderLineExtrafieldLabels); // fetch extrafields also available in orderline
$line = new ExpeditionLigne($db);
$line->fetch_optionals($object->id,$extralabelslines);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
print '</tr>';

View File

@@ -1414,7 +1414,7 @@ class CommandeFournisseur extends CommonOrder
if ($remise_percent == 0 && $prod->remise_percent !=0)
$remise_percent =$prod->remise_percent;
}
if ($result == 0) // If result == 0, we failed to found the supplier reference price
{
@@ -2678,14 +2678,14 @@ class CommandeFournisseur extends CommonOrder
if ($db->num_rows($query))
{
$obj = $db->fetch_object($query);
$string = $langs->trans($obj->code);
if ($string == $obj->code)
{
$string = $obj->label != '-' ? $obj->label : '';
}
return $string;
}
}
}
else dol_print_error($db);
}

View File

@@ -409,7 +409,7 @@ if (empty($reshook))
$localtax1_tx,
$localtax2_tx,
$idprod,
$productsupplier->id,
$productsupplier->product_fourn_price_id,
$productsupplier->fourn_ref,
$remise_percent,
'HT',

View File

@@ -156,7 +156,7 @@ ErrorPriceExpression22=Negative result '%s'
ErrorPriceExpressionInternal=Internal error '%s'
ErrorPriceExpressionUnknown=Unknown error '%s'
ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs
ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without lot/serial information, on a product requiring lot/serial information
ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without lot/serial information, on product '%s' requiring lot/serial information
ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified (approved or denied) before being allowed to do this action
ErrorCantSetReceptionToTotalDoneWithReceptionDenied=All recorded receptions must first be verified (approved) before being allowed to do this action
ErrorGlobalVariableUpdater0=HTTP request failed with error '%s'

View File

@@ -565,6 +565,14 @@ else
}
// Other attributes
if ($action = 'create_delivery') {
// copy from expedition
$expeditionExtrafields = new Extrafields($db);
$expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element);
if ($expedition->fetch_optionals($object->origin_id, $expeditionExtrafieldLabels) > 0) {
$object->array_options = array_merge($object->array_options, $expedition->array_options);
}
}
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@@ -665,6 +673,13 @@ else
$mode = ($object->statut == 0) ? 'edit' : 'view';
$line = new LivraisonLigne($db);
$line->fetch_optionals($object->lines[$i]->id,$extralabelslines);
if ($action = 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$expeditionLineExtrafields = new Extrafields($db);
$expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->fetch_optionals($expedition->lines[$i]->id,$expeditionLineExtrafieldLabels);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
}
print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, $mode, array('style'=>$bc[$var], 'colspan'=>$colspan),$i);
print '</tr>';

View File

@@ -1532,6 +1532,7 @@ class Product extends CommonObject
$obj->price = $price_result;
}
}
$this->product_fourn_price_id = $obj->rowid;
$this->buyprice = $obj->price; // deprecated
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier
$this->fourn_price_base_type = 'HT'; // Price base type
@@ -1577,6 +1578,7 @@ class Product extends CommonObject
$obj->price = $price_result;
}
}
$this->product_fourn_price_id = $obj->rowid;
$this->buyprice = $obj->price; // deprecated
$this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier
$this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier

View File

@@ -96,6 +96,7 @@ class MouvementStock extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
$langs->load("errors");
$error = 0;
dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch);
@@ -141,7 +142,7 @@ class MouvementStock extends CommonObject
{
if (empty($batch))
{
$this->errors[]=$langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->name);
$this->errors[]=$langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref);
dol_syslog("Try to make a movement of a product with status_batch on without any batch data");
$this->db->rollback();

View File

@@ -397,7 +397,7 @@ if ($id > 0 || ! empty($ref))
print '<td colspan="1">';
$thirdpartyofproject=$projectstatic->getListContactId('thirdparty');
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$projectstatic->societe->id;
$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$projectstatic->socid;
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject);
print '</td>';

View File

@@ -237,7 +237,7 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"ty.label","",$param,"",$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{