wip
This commit is contained in:
parent
9af0995cfa
commit
7581275316
@ -186,7 +186,7 @@
|
||||
<!-- Check indent are done with spaces and with correct number -->
|
||||
<!-- Disabled as this does not support tab -->
|
||||
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
|
||||
<!-- TODO Enable this
|
||||
|
||||
<arg name="tab-width" value="4"/>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
@ -194,7 +194,6 @@
|
||||
<property name="tabIndent" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
-->
|
||||
|
||||
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
|
||||
|
||||
|
||||
@ -1835,13 +1835,13 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user);
|
||||
if ($result < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user);
|
||||
if ($result < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ class Opensurveysondage extends CommonObject
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$ret=-1;
|
||||
}
|
||||
|
||||
@ -168,10 +168,10 @@ $genPriceOptions = function ($level) use ($price_options) {
|
||||
echo $langs->trans('SellingPrice').' '.$i;
|
||||
// Label of price
|
||||
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i;
|
||||
if (! empty($conf->global->$keyforlabel)) {
|
||||
print ' - '.$langs->trans($conf->global->$keyforlabel);
|
||||
}
|
||||
?>
|
||||
if (! empty($conf->global->$keyforlabel)) {
|
||||
print ' - '.$langs->trans($conf->global->$keyforlabel);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<input type="text" style="text-align: right" name="var_percent[<?php echo $i ?>]" size="5" value="<?php echo price(isset($rules[$i]) ? $rules[$i]->var_percent : 0, 2) ?>">
|
||||
|
||||
@ -483,7 +483,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
|
||||
@ -113,7 +113,7 @@ dol_fiche_head('');
|
||||
|
||||
<tr><td><?php echo $langs->trans("SellingPrice"); ?></td>
|
||||
<td><input name="price" size="10" value="<?php echo $object->price; ?>">
|
||||
<?php echo $object->price_base_type; ?>
|
||||
<?php echo $object->price_base_type; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("MinPrice"); ?></td>
|
||||
@ -121,7 +121,7 @@ dol_fiche_head('');
|
||||
</td></tr>
|
||||
|
||||
<tr><td width="20%"><?php echo $langs->trans("VATRate"); ?></td><td>
|
||||
<?php echo $object->tva_tx; ?>
|
||||
<?php echo $object->tva_tx; ?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
<?php if ($object->photos) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $object->nblines; ?>">
|
||||
<?php echo $object->photos; ?>
|
||||
<?php echo $object->photos; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ dol_fiche_head('');
|
||||
|
||||
<tr><td><?php echo $langs->trans("SellingPrice"); ?></td>
|
||||
<td><input name="price" size="10" value="<?php echo $object->price; ?>">
|
||||
<?php echo $object->price_base_type; ?>
|
||||
<?php echo $object->price_base_type; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("MinPrice"); ?></td>
|
||||
@ -93,7 +93,7 @@ dol_fiche_head('');
|
||||
</td></tr>
|
||||
|
||||
<tr><td width="20%"><?php echo $langs->trans("VATRate"); ?></td><td>
|
||||
<?php echo $object->tva_tx; ?>
|
||||
<?php echo $object->tva_tx; ?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
<?php if ($object->photos) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $object->nblines; ?>">
|
||||
<?php echo $object->photos; ?>
|
||||
<?php echo $object->photos; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -1453,13 +1453,13 @@ else
|
||||
print '</td></tr>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE))
|
||||
{
|
||||
// Brut Length
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td colspan="3">';
|
||||
print '<input name="size" size="5" value="'.$object->length.'">x';
|
||||
print '<input name="sizewidth" size="5" value="'.$object->width.'">x';
|
||||
print '<input name="sizeheight" size="5" value="'.$object->height.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
// Brut Length
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td colspan="3">';
|
||||
print '<input name="size" size="5" value="'.$object->length.'">x';
|
||||
print '<input name="sizewidth" size="5" value="'.$object->width.'">x';
|
||||
print '<input name="sizeheight" size="5" value="'.$object->height.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SURFACE))
|
||||
{
|
||||
@ -2104,7 +2104,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$html .= '<tr><td style="width: 200px;">';
|
||||
$html .= $langs->trans("AddToDraftProposals").'</td><td>';
|
||||
$html .= $langs->trans("NoDraftProposals");
|
||||
|
||||
@ -1603,85 +1603,85 @@ class Product extends CommonObject
|
||||
$price_base_type = $this->price_base_type;
|
||||
|
||||
// If price per segment
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level))
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level))
|
||||
{
|
||||
$pu_ht = $this->multiprices[$thirdparty_buyer->price_level];
|
||||
$pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level];
|
||||
$price_min = $this->multiprices_min[$thirdparty_buyer->price_level];
|
||||
$price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level];
|
||||
if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level];
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
$pu_ht = $this->multiprices[$thirdparty_buyer->price_level];
|
||||
$pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level];
|
||||
$price_min = $this->multiprices_min[$thirdparty_buyer->price_level];
|
||||
$price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level];
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level];
|
||||
if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level];
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
// If price per customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
$prodcustprice = new Productcustomerprice($db);
|
||||
|
||||
$filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id);
|
||||
$filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id);
|
||||
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result) {
|
||||
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;
|
||||
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||
if ($result) {
|
||||
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;
|
||||
if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
|
||||
{
|
||||
if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
foreach($this->prices_by_qty_list[0] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
foreach($this->prices_by_qty_list[0] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If price per quantity and customer
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
|
||||
{
|
||||
if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity
|
||||
if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity
|
||||
{
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
// Search price into product_price_by_qty from $this->id
|
||||
foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray)
|
||||
{
|
||||
if ($priceforthequantityarray['rowid'] != $pqp) continue;
|
||||
// We found the price
|
||||
if ($priceforthequantityarray['price_base_type'] == 'HT')
|
||||
{
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
$pu_ht = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ttc = $priceforthequantityarray['unitprice'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array('pu_ht'=>$pu_ht, 'pu_ttc'=>$pu_ttc, 'price_min'=>$price_min, 'price_base_type'=>$price_base_type, 'tva_tx'=>$tva_tx, 'tva_npr'=>$tva_npr);
|
||||
}
|
||||
@ -4293,14 +4293,14 @@ class Product extends CommonObject
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 0:
|
||||
case 0:
|
||||
return $this->LibStatut($this->status, $mode, $type);
|
||||
case 1:
|
||||
case 1:
|
||||
return $this->LibStatut($this->status_buy, $mode, $type);
|
||||
case 2:
|
||||
case 2:
|
||||
return $this->LibStatut($this->status_batch, $mode, $type);
|
||||
default:
|
||||
//Simulate previous behavior but should return an error string
|
||||
default:
|
||||
//Simulate previous behavior but should return an error string
|
||||
return $this->LibStatut($this->status_buy, $mode, $type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,45 +6,45 @@ require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php';
|
||||
$get = GETPOST('get', 'alpha');
|
||||
$put = GETPOST('put', 'alpha');
|
||||
|
||||
switch ($put)
|
||||
{
|
||||
case 'qty':
|
||||
if (empty($user->rights->stock->creer)) { echo -1; exit; }
|
||||
switch ($put)
|
||||
{
|
||||
case 'qty':
|
||||
if (empty($user->rights->stock->creer)) { echo -1; exit; }
|
||||
|
||||
$fk_det_inventory = GETPOST('fk_det_inventory');
|
||||
$fk_det_inventory = GETPOST('fk_det_inventory');
|
||||
|
||||
$det = new InventoryLine($db);
|
||||
if( $det->fetch($fk_det_inventory))
|
||||
{
|
||||
$det->qty_view+=GETPOST('qty');
|
||||
$res = $det->update($user);
|
||||
$det = new InventoryLine($db);
|
||||
if( $det->fetch($fk_det_inventory))
|
||||
{
|
||||
$det->qty_view+=GETPOST('qty');
|
||||
$res = $det->update($user);
|
||||
|
||||
echo $det->qty_view;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo -2;
|
||||
}
|
||||
echo $det->qty_view;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo -2;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'pmp':
|
||||
if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; }
|
||||
case 'pmp':
|
||||
if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; }
|
||||
|
||||
$fk_det_inventory = GETPOST('fk_det_inventory');
|
||||
$fk_det_inventory = GETPOST('fk_det_inventory');
|
||||
|
||||
$det = new InventoryLine($db);
|
||||
if( $det->fetch($fk_det_inventory))
|
||||
{
|
||||
$det->new_pmp=price2num(GETPOST('pmp'));
|
||||
$det->update($user);
|
||||
$det = new InventoryLine($db);
|
||||
if( $det->fetch($fk_det_inventory))
|
||||
{
|
||||
$det->new_pmp=price2num(GETPOST('pmp'));
|
||||
$det->update($user);
|
||||
|
||||
echo $det->new_pmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo -2;
|
||||
}
|
||||
echo $det->new_pmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo -2;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -475,10 +475,10 @@ if (empty($reshook))
|
||||
{
|
||||
$priceid = GETPOST('priceid', 'int');
|
||||
if (!empty($rowid)) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty";
|
||||
$sql .= " WHERE fk_product_price = " . $priceid;
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty";
|
||||
$sql .= " WHERE fk_product_price = " . $priceid;
|
||||
|
||||
$result = $db->query($sql);
|
||||
$result = $db->query($sql);
|
||||
} else {
|
||||
setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors');
|
||||
}
|
||||
@ -755,17 +755,17 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("DefaultTaxRate") . '</td><td colspan="2">';
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("DefaultTaxRate") . '</td><td colspan="2">';
|
||||
|
||||
$positiverates='';
|
||||
if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]);
|
||||
if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]);
|
||||
if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
//print vatrate($object->multiprices_tva_tx[$soc->price_level], true);
|
||||
print '</td></tr>';
|
||||
$positiverates='';
|
||||
if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]);
|
||||
if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]);
|
||||
if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]);
|
||||
if (empty($positiverates)) $positiverates='0';
|
||||
echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr);
|
||||
//print vatrate($object->multiprices_tva_tx[$soc->price_level], true);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -791,10 +791,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI
|
||||
{
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// We show only vat for level 1
|
||||
print '<tr><td class="titlefield">' . $langs->trans("DefaultTaxRate") . '</td>';
|
||||
print '<td colspan="2">' . vatrate($object->multiprices_tva_tx[1], true) . '</td>';
|
||||
print '</tr>';
|
||||
// We show only vat for level 1
|
||||
print '<tr><td class="titlefield">' . $langs->trans("DefaultTaxRate") . '</td>';
|
||||
print '<td colspan="2">' . vatrate($object->multiprices_tva_tx[1], true) . '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -68,8 +68,8 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
// if ($ret > 0)
|
||||
// $ret = $object->fetch_thirdparty();
|
||||
// if ($ret > 0)
|
||||
// $ret = $object->fetch_thirdparty();
|
||||
if ($ret <= 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
|
||||
@ -947,8 +947,8 @@ class MouvementStock extends CommonObject
|
||||
$result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php');
|
||||
if ($result)
|
||||
{
|
||||
$classname = ucfirst($origintype);
|
||||
$origin = new $classname($this->db);
|
||||
$classname = ucfirst($origintype);
|
||||
$origin = new $classname($this->db);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -195,7 +195,7 @@ if ($action == 'createmovements')
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) // If product does not need lot/serial
|
||||
{
|
||||
// Remove stock
|
||||
$result1=$product->correct_stock(
|
||||
$result1=$product->correct_stock(
|
||||
$user,
|
||||
$id_sw,
|
||||
$qty,
|
||||
@ -211,7 +211,7 @@ if ($action == 'createmovements')
|
||||
}
|
||||
|
||||
// Add stock
|
||||
$result2=$product->correct_stock(
|
||||
$result2=$product->correct_stock(
|
||||
$user,
|
||||
$id_tw,
|
||||
$qty,
|
||||
@ -243,7 +243,7 @@ if ($action == 'createmovements')
|
||||
}
|
||||
|
||||
// Remove stock
|
||||
$result1=$product->correct_stock_batch(
|
||||
$result1=$product->correct_stock_batch(
|
||||
$user,
|
||||
$id_sw,
|
||||
$qty,
|
||||
@ -262,7 +262,7 @@ if ($action == 'createmovements')
|
||||
}
|
||||
|
||||
// Add stock
|
||||
$result2=$product->correct_stock_batch(
|
||||
$result2=$product->correct_stock_batch(
|
||||
$user,
|
||||
$id_tw,
|
||||
$qty,
|
||||
|
||||
@ -202,7 +202,7 @@ if ($action == "correct_stock")
|
||||
$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(
|
||||
$result=$product->correct_stock_batch(
|
||||
$user,
|
||||
$id,
|
||||
GETPOST("nbpiece", 'int'),
|
||||
@ -217,7 +217,7 @@ if ($action == "correct_stock")
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$product->correct_stock(
|
||||
$result=$product->correct_stock(
|
||||
$user,
|
||||
$id,
|
||||
GETPOST("nbpiece", 'int'),
|
||||
|
||||
@ -374,7 +374,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
if (! $error)
|
||||
{
|
||||
// Remove stock
|
||||
$result1=$object->correct_stock_batch(
|
||||
$result1=$object->correct_stock_batch(
|
||||
$user,
|
||||
$srcwarehouseid,
|
||||
GETPOST("nbpiece", 'int'),
|
||||
@ -389,7 +389,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
if (! $error)
|
||||
{
|
||||
// Add stock
|
||||
$result2=$object->correct_stock_batch(
|
||||
$result2=$object->correct_stock_batch(
|
||||
$user,
|
||||
GETPOST("id_entrepot_destination", 'int'),
|
||||
GETPOST("nbpiece", 'int'),
|
||||
|
||||
@ -180,7 +180,7 @@ if (empty($reshook))
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
@ -369,7 +369,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
/*TODO if ($user->rights->stock->lire)
|
||||
/*TODO if ($user->rights->stock->lire)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
}
|
||||
@ -378,7 +378,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
|
||||
@ -107,10 +107,10 @@ $arrayfields=array(
|
||||
// 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($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load object if id or ref is provided as parameter
|
||||
|
||||
@ -492,7 +492,7 @@ if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alph
|
||||
$filters .= '&mode=' . $mode;
|
||||
$filters .= '&fk_supplier=' . $fk_supplier;
|
||||
$filters .= '&fk_entrepot=' . $fk_entrepot;
|
||||
print_barre_liste(
|
||||
print_barre_liste(
|
||||
$texte,
|
||||
$page,
|
||||
'replenish.php',
|
||||
@ -511,7 +511,7 @@ print_barre_liste(
|
||||
$filters .= '&mode=' . $mode;
|
||||
$filters .= '&fk_supplier=' . $fk_supplier;
|
||||
$filters .= '&fk_entrepot=' . $fk_entrepot;
|
||||
print_barre_liste(
|
||||
print_barre_liste(
|
||||
$texte,
|
||||
$page,
|
||||
'replenish.php',
|
||||
|
||||
@ -66,28 +66,28 @@ if (empty($conf) || ! is_object($conf)) {
|
||||
|
||||
// Warehouse or product
|
||||
print '<tr>';
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td>';
|
||||
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
|
||||
print ' <select name="mouvement" id="mouvement">';
|
||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
|
||||
print '</select>';
|
||||
print '</td>';
|
||||
}
|
||||
if ($object->element == 'stock')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
|
||||
print ' <select name="mouvement" id="mouvement">';
|
||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
|
||||
print '</select>';
|
||||
print '</td>';
|
||||
}
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td>';
|
||||
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
|
||||
print ' <select name="mouvement" id="mouvement">';
|
||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
|
||||
print '</select>';
|
||||
print '</td>';
|
||||
}
|
||||
if ($object->element == 'stock')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
|
||||
print ' <select name="mouvement" id="mouvement">';
|
||||
print '<option value="0">'.$langs->trans("Add").'</option>';
|
||||
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
|
||||
print '</select>';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
|
||||
print '<td><input name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
|
||||
print '</tr>';
|
||||
@ -96,37 +96,37 @@ if (empty($conf) || ! is_object($conf)) {
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>';
|
||||
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<td>'.$langs->trans('Project').'</td>';
|
||||
print '<td>';
|
||||
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<td>'.$langs->trans('Project').'</td>';
|
||||
print '<td>';
|
||||
$formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Serial / Eat-by date
|
||||
if (! empty($conf->productbatch->enabled) &&
|
||||
if (! empty($conf->productbatch->enabled) &&
|
||||
(($object->element == 'product' && $object->hasbatch())
|
||||
|| ($object->element == 'stock'))
|
||||
)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
|
||||
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("EatByDate").'</td><td>';
|
||||
$eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
|
||||
print $form->selectDate($eatbyselected, 'eatby', '', '', 1, "");
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("SellByDate").'</td><td>';
|
||||
$sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
|
||||
print $form->selectDate($sellbyselected, 'sellby', '', '', 1, "");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
|
||||
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("EatByDate").'</td><td>';
|
||||
$eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
|
||||
print $form->selectDate($eatbyselected, 'eatby', '', '', 1, "");
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("SellByDate").'</td><td>';
|
||||
$sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
|
||||
print $form->selectDate($sellbyselected, 'sellby', '', '', 1, "");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Label of mouvement of id of inventory
|
||||
$valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
|
||||
|
||||
@ -40,18 +40,18 @@ if (empty($conf) || ! is_object($conf)) {
|
||||
|
||||
$pdluo = new Productbatch($db);
|
||||
|
||||
if ($pdluoid > 0)
|
||||
{
|
||||
$result=$pdluo->fetch($pdluoid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$pdluoid=$pdluo->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db, $pdluo->error, $pdluo->errors);
|
||||
}
|
||||
}
|
||||
if ($pdluoid > 0)
|
||||
{
|
||||
$result=$pdluo->fetch($pdluoid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$pdluoid=$pdluo->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db, $pdluo->error, $pdluo->errors);
|
||||
}
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
|
||||
|
||||
@ -62,28 +62,28 @@ if (empty($conf) || ! is_object($conf)) {
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="transfert_stock">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
if ($pdluoid)
|
||||
{
|
||||
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
|
||||
}
|
||||
if ($pdluoid)
|
||||
{
|
||||
print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
|
||||
}
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Source warehouse or product
|
||||
print '<tr>';
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
|
||||
print '<td>';
|
||||
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if ($object->element == 'stock')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
|
||||
print '</td>';
|
||||
}
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
|
||||
print '<td>';
|
||||
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if ($object->element == 'stock')
|
||||
{
|
||||
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
|
||||
print '<td>';
|
||||
print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
|
||||
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
|
||||
@ -92,35 +92,35 @@ if (empty($conf) || ! is_object($conf)) {
|
||||
print '</tr>';
|
||||
|
||||
// Serial / Eat-by date
|
||||
if (! empty($conf->productbatch->enabled) &&
|
||||
if (! empty($conf->productbatch->enabled) &&
|
||||
(($object->element == 'product' && $object->hasbatch())
|
||||
|| ($object->element == 'stock'))
|
||||
)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
|
||||
if ($pdluoid > 0)
|
||||
{
|
||||
// If form was opened for a specific pdluoid, field is disabled
|
||||
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
|
||||
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="batch_number" size="40" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
|
||||
if ($pdluoid > 0)
|
||||
{
|
||||
// If form was opened for a specific pdluoid, field is disabled
|
||||
print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
|
||||
print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" name="batch_number" size="40" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("EatByDate").'</td><td>';
|
||||
print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("SellByDate").'</td><td>';
|
||||
print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("EatByDate").'</td><td>';
|
||||
print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("SellByDate").'</td><td>';
|
||||
print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Label
|
||||
$valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref));
|
||||
|
||||
@ -813,23 +813,23 @@ if (count($tasksarray) > 0)
|
||||
print ' - '.$langs->trans("ExpectedWorkedHours").': <strong>'.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).'</strong>';
|
||||
print '</td>';
|
||||
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
{
|
||||
$cssweekend='';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend='weekend';
|
||||
}
|
||||
$cssweekend='';
|
||||
if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css.
|
||||
{
|
||||
$cssweekend='weekend';
|
||||
}
|
||||
|
||||
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
||||
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
|
||||
|
||||
$cssonholiday='';
|
||||
if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday ';
|
||||
elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning ';
|
||||
elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
|
||||
$cssonholiday='';
|
||||
if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday ';
|
||||
elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning ';
|
||||
elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon ';
|
||||
|
||||
print '<td class="liste_total hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'" align="center"><div class="totalDay'.$idw.'"> </div></td>';
|
||||
}
|
||||
print '<td class="liste_total hide'.$idw.($cssonholiday?' '.$cssonholiday:'').($cssweekend?' '.$cssweekend:'').'" align="center"><div class="totalDay'.$idw.'"> </div></td>';
|
||||
}
|
||||
print '<td class="liste_total center"><div class="totalDayAll"> </div></td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ class Project extends CommonObject
|
||||
$result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->db->rollback();
|
||||
$result = -1;
|
||||
}
|
||||
@ -1222,7 +1222,7 @@ class Project extends CommonObject
|
||||
// No filter. Use this if user has permission to see all project
|
||||
}
|
||||
|
||||
$sql.= $filter;
|
||||
$sql.= $filter;
|
||||
//print $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1722,23 +1722,23 @@ class Project extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
// Loop on each record found, so each couple (project id, task id)
|
||||
while ($i < $num)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$day=$this->db->jdate($obj->task_date); // task_date is date without hours
|
||||
if (empty($daylareadyfound[$day]))
|
||||
{
|
||||
$this->weekWorkLoad[$day] = $obj->task_duration;
|
||||
$this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->weekWorkLoad[$day] += $obj->task_duration;
|
||||
$this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration;
|
||||
}
|
||||
$daylareadyfound[$day]=1;
|
||||
$i++;
|
||||
}
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
$day=$this->db->jdate($obj->task_date); // task_date is date without hours
|
||||
if (empty($daylareadyfound[$day]))
|
||||
{
|
||||
$this->weekWorkLoad[$day] = $obj->task_duration;
|
||||
$this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->weekWorkLoad[$day] += $obj->task_duration;
|
||||
$this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration;
|
||||
}
|
||||
$daylareadyfound[$day]=1;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -852,15 +852,15 @@ class Task extends CommonObject
|
||||
$sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,";
|
||||
$sql.=" t.dateo, t.datee, t.planned_workload, t.rang,";
|
||||
$sql.=" s.rowid, s.nom, s.email,";
|
||||
$sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount";
|
||||
if (!empty($extrafields->attributes['projet']['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : '');
|
||||
}
|
||||
if (!empty($extrafields->attributes['projet_task']['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : '');
|
||||
}
|
||||
$sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount";
|
||||
if (!empty($extrafields->attributes['projet']['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : '');
|
||||
}
|
||||
if (!empty($extrafields->attributes['projet_task']['label']))
|
||||
{
|
||||
foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : '');
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= " ORDER BY p.ref, t.rang, t.dateo";
|
||||
|
||||
@ -863,8 +863,8 @@ foreach ($listofreferent as $key => $value)
|
||||
|
||||
if (canApplySubtotalOn($tablename))
|
||||
{
|
||||
// Sort
|
||||
$elementarray = sortElementsByClientName($elementarray);
|
||||
// Sort
|
||||
$elementarray = sortElementsByClientName($elementarray);
|
||||
}
|
||||
|
||||
$num=count($elementarray);
|
||||
@ -1077,9 +1077,9 @@ foreach ($listofreferent as $key => $value)
|
||||
if ($othermessage) print $othermessage;
|
||||
if (isset($total_ht_by_line))
|
||||
{
|
||||
if (! $qualifiedfortotal) print '<strike>';
|
||||
print price($total_ht_by_line);
|
||||
if (! $qualifiedfortotal) print '</strike>';
|
||||
if (! $qualifiedfortotal) print '<strike>';
|
||||
print price($total_ht_by_line);
|
||||
if (! $qualifiedfortotal) print '</strike>';
|
||||
}
|
||||
if ($warning) print ' '.img_warning($warning);
|
||||
print '</td>';
|
||||
@ -1124,9 +1124,9 @@ foreach ($listofreferent as $key => $value)
|
||||
if ($othermessage) print $othermessage;
|
||||
if (isset($total_ttc_by_line))
|
||||
{
|
||||
if (! $qualifiedfortotal) print '<strike>';
|
||||
print price($total_ttc_by_line);
|
||||
if (! $qualifiedfortotal) print '</strike>';
|
||||
if (! $qualifiedfortotal) print '<strike>';
|
||||
print price($total_ttc_by_line);
|
||||
if (! $qualifiedfortotal) print '</strike>';
|
||||
}
|
||||
if ($warning) print ' '.img_warning($warning);
|
||||
print '</td>';
|
||||
|
||||
@ -35,11 +35,11 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
$valsamount[$obj->opp_status]=$obj->opp_amount;
|
||||
$totalnb+=$obj->nb;
|
||||
if ($obj->opp_status) $totaloppnb+=$obj->nb;
|
||||
if (! in_array($obj->code, array('WON', 'LOST')))
|
||||
if (! in_array($obj->code, array('WON', 'LOST')))
|
||||
{
|
||||
$totalamount+=$obj->opp_amount;
|
||||
$ponderated_opp_amount+=$obj->ponderated_opp_amount;
|
||||
}
|
||||
$totalamount+=$obj->opp_amount;
|
||||
$ponderated_opp_amount+=$obj->ponderated_opp_amount;
|
||||
}
|
||||
}
|
||||
$total+=$row[0];
|
||||
}
|
||||
|
||||
@ -143,10 +143,10 @@ $arrayfields=array(
|
||||
// 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($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
unset($data1);
|
||||
|
||||
if ($nocolor)
|
||||
$px->SetDataColor(array (
|
||||
$px->SetDataColor(array (
|
||||
array (
|
||||
220,
|
||||
220,
|
||||
@ -130,9 +130,9 @@ $px->SetDataColor(array (
|
||||
));
|
||||
$px->SetTitle($langs->trans('OpportunitiesStatusForProjects'));
|
||||
$result=$px->draw($filenamenb, $fileurlnb);
|
||||
if ($result<0) {
|
||||
setEventMessages($px->error, null, 'errors');
|
||||
}
|
||||
if ($result<0) {
|
||||
setEventMessages($px->error, null, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages(null, $mesgs, 'errors');
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ elseif ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Link to create task
|
||||
// Link to create task
|
||||
$linktocreatetaskParam = array();
|
||||
$linktocreatetaskUserRight = false;
|
||||
if ($user->rights->projet->all->creer || $user->rights->projet->creer) {
|
||||
@ -787,8 +787,8 @@ elseif ($id > 0 || ! empty($ref))
|
||||
print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center ');
|
||||
if ($object->usage_bill_time)
|
||||
{
|
||||
print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
|
||||
@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref))
|
||||
/*
|
||||
* Lines of contacts
|
||||
*/
|
||||
/*
|
||||
/*
|
||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
@ -364,7 +364,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
|
||||
if ($res) break;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Add a new contact line
|
||||
|
||||
@ -616,7 +616,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if (! $object->hasChildren() && ! $object->hasTimeSpent())
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&withproject='.$withproject.'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&withproject='.$withproject.'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -169,7 +169,7 @@ class BankAccountTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testBankAccountOther
|
||||
*
|
||||
* @param Object $localobject Object contract
|
||||
|
||||
@ -173,7 +173,7 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase
|
||||
* @depends testBonPrelevementOther
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
/* public function testBonPrelevementDelete($id)
|
||||
/* public function testBonPrelevementDelete($id)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
@ -189,5 +189,5 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertLessThan($result, 0);
|
||||
return $result;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ class ContratTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testContratOther
|
||||
*
|
||||
* @param Object $localobject Object contract
|
||||
|
||||
@ -265,7 +265,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
|
||||
public function testExportPersonalizedWithFilter()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
/*
|
||||
/*
|
||||
$sql = "SELECT f.ref as f_ref, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f";
|
||||
|
||||
$objexport=new Export($db);
|
||||
@ -303,7 +303,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
|
||||
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $sql);
|
||||
$expectedresult=1;
|
||||
$this->assertEquals($expectedresult,$result);
|
||||
*/
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ class FactureFournisseurTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testFactureFournisseurOther
|
||||
*
|
||||
* @param Object $localobject Supplier invoice
|
||||
|
||||
@ -241,7 +241,7 @@ class FactureTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testFactureOther
|
||||
*
|
||||
* @param Object $localobject Invoice
|
||||
|
||||
@ -190,7 +190,7 @@ class FichinterTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testFichinterValid
|
||||
*
|
||||
* @param Object $localobject Object intervention
|
||||
|
||||
@ -150,11 +150,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testDolCountNbOfLine
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
/**
|
||||
* testDolCountNbOfLine
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolCountNbOfLine()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
@ -171,11 +171,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolIsFileDir
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
/**
|
||||
* testDolIsFileDir
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolIsFileDir()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
@ -118,11 +118,11 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolCountNbOfLine
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
/**
|
||||
* testDolCountNbOfLine
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testgetImageSize()
|
||||
{
|
||||
$file=dirname(__FILE__).'/img250x50.jpg';
|
||||
|
||||
@ -239,7 +239,7 @@ class PropalTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testPropalOther
|
||||
*
|
||||
* @param Propal $localobject Proposal
|
||||
|
||||
@ -149,30 +149,30 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testRestGetUser()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
global $conf,$user,$langs,$db;
|
||||
|
||||
$url = $this->api_url.'/users/123456789?api_key='.$this->api_key;
|
||||
//$addheaders=array('Content-Type: application/json');
|
||||
$url = $this->api_url.'/users/123456789?api_key='.$this->api_key;
|
||||
//$addheaders=array('Content-Type: application/json');
|
||||
|
||||
print __METHOD__." Request GET url=".$url."\n";
|
||||
$result=getURLContent($url, 'GET', '', 1, array());
|
||||
//print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(404, $object['error']['code']);
|
||||
print __METHOD__." Request GET url=".$url."\n";
|
||||
$result=getURLContent($url, 'GET', '', 1, array());
|
||||
//print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(404, $object['error']['code']);
|
||||
|
||||
$url = $this->api_url.'/users/1?api_key='.$this->api_key;
|
||||
$url = $this->api_url.'/users/1?api_key='.$this->api_key;
|
||||
|
||||
print __METHOD__." Request GET url=".$url."\n";
|
||||
$result=getURLContent($url, 'GET', '', 1, array());
|
||||
//print __METHOD__." Result for existing user user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(1, $object['statut']);
|
||||
print __METHOD__." Request GET url=".$url."\n";
|
||||
$result=getURLContent($url, 'GET', '', 1, array());
|
||||
//print __METHOD__." Result for existing user user: ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(1, $object['statut']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,52 +183,52 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
public function testRestCreateUser()
|
||||
{
|
||||
|
||||
// attemp to create without mandatory fields :
|
||||
$url = $this->api_url.'/users?api_key='.$this->api_key;
|
||||
$addheaders=array('Content-Type: application/json');
|
||||
// attemp to create without mandatory fields :
|
||||
$url = $this->api_url.'/users?api_key='.$this->api_key;
|
||||
$addheaders=array('Content-Type: application/json');
|
||||
|
||||
$bodyobj = array(
|
||||
"lastname"=>"testRestUser",
|
||||
"password"=>"testRestPassword",
|
||||
"email"=>"test@restuser.com"
|
||||
);
|
||||
$body = json_encode($bodyobj);
|
||||
$bodyobj = array(
|
||||
"lastname"=>"testRestUser",
|
||||
"password"=>"testRestPassword",
|
||||
"email"=>"test@restuser.com"
|
||||
);
|
||||
$body = json_encode($bodyobj);
|
||||
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders);
|
||||
//print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders);
|
||||
//print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
|
||||
// create regular user
|
||||
unset($result);
|
||||
$bodyobj = array(
|
||||
"login"=>"testRestLogin".mt_rand(),
|
||||
"lastname"=>"testRestUser",
|
||||
"password"=>"testRestPassword",
|
||||
"email"=>"test@restuser.com"
|
||||
);
|
||||
$body = json_encode($bodyobj);
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders);
|
||||
print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$resid=json_decode($result['content'], true);
|
||||
$this->assertNotNull($resid, "Parsing of json result must no be null");
|
||||
$this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']);
|
||||
// create regular user
|
||||
unset($result);
|
||||
$bodyobj = array(
|
||||
"login"=>"testRestLogin".mt_rand(),
|
||||
"lastname"=>"testRestUser",
|
||||
"password"=>"testRestPassword",
|
||||
"email"=>"test@restuser.com"
|
||||
);
|
||||
$body = json_encode($bodyobj);
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders);
|
||||
print __METHOD__." Result code for creating user ".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$resid=json_decode($result['content'], true);
|
||||
$this->assertNotNull($resid, "Parsing of json result must no be null");
|
||||
$this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']);
|
||||
|
||||
// attempt to create duplicated user
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders);
|
||||
//print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
// attempt to create duplicated user
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
$result=getURLContent($url, 'POST', $body, 1, $addheaders);
|
||||
//print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n";
|
||||
print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n";
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* testSupplierProposalOther
|
||||
*
|
||||
* @param SupplierProposal $localobject Proposal
|
||||
|
||||
@ -67,14 +67,14 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
|
||||
),
|
||||
// Geckodriver does not keep the session at the moment?!
|
||||
// XPath selectors also don't seem to work
|
||||
// array(
|
||||
// 'browser' => 'Mozilla Firefox on Linux',
|
||||
// 'browserName' => 'firefox',
|
||||
// 'sessionStrategy' => 'shared',
|
||||
// 'desiredCapabilities' => array(
|
||||
// 'marionette' => true
|
||||
// )
|
||||
// )
|
||||
//array(
|
||||
// 'browser' => 'Mozilla Firefox on Linux',
|
||||
// 'browserName' => 'firefox',
|
||||
// 'sessionStrategy' => 'shared',
|
||||
// 'desiredCapabilities' => array(
|
||||
// 'marionette' => true
|
||||
// )
|
||||
//)
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user