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

This commit is contained in:
Philippe GRAND 2018-08-31 16:37:03 +02:00
commit 6474646e4b
4 changed files with 40 additions and 148 deletions

View File

@ -1574,10 +1574,10 @@ class Propal extends CommonObject
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; $sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
$sql.= ' d.fk_unit,'; $sql.= ' d.fk_unit,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobach as product_batch,';
$sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,'; $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,';
$sql.= ' d.date_start, d.date_end'; $sql.= ' d.date_start, d.date_end,';
$sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as d'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as d';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)';
$sql.= ' WHERE d.fk_propal = '.$this->id; $sql.= ' WHERE d.fk_propal = '.$this->id;
@ -1639,7 +1639,8 @@ class Propal extends CommonObject
$line->libelle = $objp->product_label; // TODO deprecated $line->libelle = $objp->product_label; // TODO deprecated
$line->product_label = $objp->product_label; $line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit $line->product_desc = $objp->product_desc; // Description produit
$line->fk_product_type = $objp->fk_product_type; $line->product_tobatch = $objp->product_tobatch;
$line->fk_product_type = $objp->fk_product_type; // TODO deprecated
$line->fk_unit = $objp->fk_unit; $line->fk_unit = $objp->fk_unit;
$line->weight = $objp->weight; $line->weight = $objp->weight;
$line->weight_units = $objp->weight_units; $line->weight_units = $objp->weight_units;
@ -3511,8 +3512,8 @@ class Propal extends CommonObject
*/ */
function getLinesArray() function getLinesArray()
{ {
// TODO Duplicate with fetch_lines ? Wich one to keep ? return $this->fetch_lines();
/*
$this->lines = array(); $this->lines = array();
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
@ -3601,7 +3602,7 @@ class Propal extends CommonObject
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }*/
} }
/** /**

View File

@ -1771,7 +1771,7 @@ function getSoapParams()
*/ */
function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='') function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
{ {
global $db,$conf; global $db, $conf, $langs;
$ret=''; $ret='';

View File

@ -511,9 +511,18 @@ if ($id > 0 || ! empty($ref)) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Description") . '</td>'; print '<td>' . $langs->trans("Description") . '</td>';
print '<td></td>'; if (! empty($conf->productbatch->enabled))
print '<td></td>'; {
print '<td></td>'; print '<td>' . $langs->trans("batch_number") . '</td>';
print '<td>' . $langs->trans("EatByDate") . '</td>';
print '<td>' . $langs->trans("SellByDate") . '</td>';
}
else
{
print '<td></td>';
print '<td></td>';
print '<td></td>';
}
print '<td align="right">' . $langs->trans("SupplierRef") . '</td>'; print '<td align="right">' . $langs->trans("SupplierRef") . '</td>';
print '<td align="right">' . $langs->trans("QtyOrdered") . '</td>'; print '<td align="right">' . $langs->trans("QtyOrdered") . '</td>';
print '<td align="right">' . $langs->trans("QtyDispatchedShort") . '</td>'; print '<td align="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
@ -521,16 +530,6 @@ if ($id > 0 || ! empty($ref)) {
print '<td width="32"></td>'; print '<td width="32"></td>';
print '<td align="right">' . $langs->trans("Warehouse") . '</td>'; print '<td align="right">' . $langs->trans("Warehouse") . '</td>';
print "</tr>\n"; print "</tr>\n";
if (! empty($conf->productbatch->enabled)) {
print '<tr class="liste_titre">';
print '<td></td>';
print '<td>' . $langs->trans("batch_number") . '</td>';
print '<td>' . $langs->trans("EatByDate") . '</td>';
print '<td>' . $langs->trans("SellByDate") . '</td>';
print '<td colspan="5">&nbsp;</td>';
print "</tr>\n";
}
} }
$nbfreeproduct = 0; // Nb of lins of free products/services $nbfreeproduct = 0; // Nb of lins of free products/services
@ -638,7 +637,7 @@ if ($id > 0 || ! empty($ref)) {
$dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year')); $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year'));
$form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, ""); $form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, "");
print '</td>'; print '</td>';
print '<td colspan="2">&nbsp</td>'; // Qty ordered + qty already dispatached print '<td colspan="3">&nbsp</td>'; // Supplier ref + Qty ordered + qty already dispatched
} else { } else {
$type = 'dispatch'; $type = 'dispatch';
print '<td align="right">'; print '<td align="right">';
@ -650,7 +649,7 @@ if ($id > 0 || ! empty($ref)) {
print '</tr>'; print '</tr>';
print '<tr class="oddeven" name="' . $type . $suffix . '">'; print '<tr class="oddeven" name="' . $type . $suffix . '">';
print '<td colspan="6">'; print '<td colspan="7">';
print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">'; print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">';
print '<input name="product' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">'; print '<input name="product' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">';
@ -672,7 +671,7 @@ if ($id > 0 || ! empty($ref)) {
print '<input id="qty' . $suffix . '" name="qty' . $suffix . '" type="text" class="width50 right" value="' . (GETPOST('qty' . $suffix) != '' ? GETPOST('qty' . $suffix) : $remaintodispatch) . '">'; print '<input id="qty' . $suffix . '" name="qty' . $suffix . '" type="text" class="width50 right" value="' . (GETPOST('qty' . $suffix) != '' ? GETPOST('qty' . $suffix) : $remaintodispatch) . '">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) {
$type = 'batch'; $type = 'batch';
//print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');

View File

@ -1348,114 +1348,6 @@ class Societe extends CommonObject
return $result; return $result;
} }
/**
* Search and fetch thirparties by name
*
* @param string $name Name
* @param int $type Type of thirdparties (0=any, 1=customer, 2=prospect, 3=supplier)
* @param array $filters Array of couple field name/value to filter the companies with the same name
* @param boolean $exact Exact string search (true/false)
* @param boolean $case Case sensitive (true/false)
* @param boolean $similar Add test if string inside name into database, or name into database inside string. Do not use this: Not compatible with other database.
* @param string $clause Clause for filters
* @return array|int <0 if KO, array of thirdparties object if OK
*/
function searchByName($name, $type='0', $filters = array(), $exact = false, $case = false, $similar = false, $clause = 'AND')
{
$thirdparties = array();
dol_syslog("searchByName name=".$name." type=".$type." exact=".$exact);
// Check parameter
if (empty($name))
{
$this->errors[]='ErrorBadValueForParameter';
return -1;
}
// Generation requete recherche
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE entity IN (".getEntity('category').")";
if (! empty($type))
{
if ($type == 1 || $type == 2)
$sql.= " AND client = ".$type;
elseif ($type == 3)
$sql.= " AND fournisseur = 1";
}
if (! empty($name))
{
if (! $exact)
{
if (preg_match('/^([\*])?[^*]+([\*])?$/', $name, $regs) && count($regs) > 1)
{
$name = str_replace('*', '%', $name);
}
else
{
$name = '%'.$name.'%';
}
}
$sql.= " AND ";
if (is_array($filters) && ! empty($filters))
$sql.= "(";
if ($similar)
{
// For test similitude (string inside name into database, or name into database inside string)
// Do not use this. Not compatible with other database.
$sql.= "(LOCATE('".$this->db->escape($name)."', nom) > 0 OR LOCATE(nom, '".$this->db->escape($name)."') > 0)";
}
else
{
if (! $case)
$sql.= "nom LIKE '".$this->db->escape($name)."'";
else
$sql.= "nom LIKE BINARY '".$this->db->escape($name)."'";
}
}
if (is_array($filters) && ! empty($filters))
{
foreach($filters as $field => $value)
{
if (! $exact)
{
if (preg_match('/^([\*])?[^*]+([\*])?$/', $value, $regs) && count($regs) > 1)
{
$value = str_replace('*', '%', $value);
}
else
{
$value = '%'.$value.'%';
}
}
if (! $case)
$sql.= " ".$clause." ".$field." LIKE '".$this->db->escape($value)."'";
else
$sql.= " ".$clause." ".$field." LIKE BINARY '".$this->db->escape($value)."'";
}
if (! empty($name))
$sql.= ")";
}
$res = $this->db->query($sql);
if ($res)
{
while ($rec = $this->db->fetch_array($res))
{
$soc = new Societe($this->db);
$soc->fetch($rec['rowid']);
$thirdparties[] = $soc;
}
return $thirdparties;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
}
/** /**
* Delete a third party from database and all its dependencies (contacts, rib...) * Delete a third party from database and all its dependencies (contacts, rib...)
* *