New: Can convert a product/service into service/product.
This commit is contained in:
parent
e45bbb622a
commit
00b7ad4a78
@ -57,6 +57,7 @@ For users:
|
|||||||
- New: All professional id can contains up to 128 chars instead of 32.
|
- New: All professional id can contains up to 128 chars instead of 32.
|
||||||
- New: [ task #176 ] Allow to use ODT templates for proposals and orders like it's done for invoices
|
- New: [ task #176 ] Allow to use ODT templates for proposals and orders like it's done for invoices
|
||||||
- New: Add hidden option MAIN_ADD_PDF_BACKGROUND to add a PDF as background of invoice/order generated PDF.
|
- New: Add hidden option MAIN_ADD_PDF_BACKGROUND to add a PDF as background of invoice/order generated PDF.
|
||||||
|
- New: Can convert a product/service into service/product.
|
||||||
- Fix: Can use POS module with several concurrent users.
|
- Fix: Can use POS module with several concurrent users.
|
||||||
- Fix: Installer don't fails with Mysql version that added a ssl_cypher field.
|
- Fix: Installer don't fails with Mysql version that added a ssl_cypher field.
|
||||||
- Fix: Sanitize input parameters.
|
- Fix: Sanitize input parameters.
|
||||||
|
|||||||
@ -156,6 +156,16 @@ class Form
|
|||||||
{
|
{
|
||||||
$ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname);
|
$ret.=$this->form_date($_SERVER['PHP_SELF'].'?id='.$object->id,$value,$htmlname);
|
||||||
}
|
}
|
||||||
|
else if (preg_match('/^select;/',$typeofdata))
|
||||||
|
{
|
||||||
|
$arraydata=explode(',',preg_replace('/^select;/','',$typeofdata));
|
||||||
|
foreach($arraydata as $val)
|
||||||
|
{
|
||||||
|
$tmp=explode(':',$val);
|
||||||
|
$arraylist[$tmp[0]]=$tmp[1];
|
||||||
|
}
|
||||||
|
$ret.=$this->selectarray($htmlname,$arraylist,$value);
|
||||||
|
}
|
||||||
else if (preg_match('/^ckeditor/',$typeofdata))
|
else if (preg_match('/^ckeditor/',$typeofdata))
|
||||||
{
|
{
|
||||||
$tmp=explode(':',$typeofdata);
|
$tmp=explode(':',$typeofdata);
|
||||||
@ -173,6 +183,16 @@ class Form
|
|||||||
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
|
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
|
||||||
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
|
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
|
||||||
elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($value);
|
elseif ($typeofdata == 'text' || $typeofdata == 'textarea') $ret.=dol_htmlentitiesbr($value);
|
||||||
|
else if (preg_match('/^select;/',$typeofdata))
|
||||||
|
{
|
||||||
|
$arraydata=explode(',',preg_replace('/^select;/','',$typeofdata));
|
||||||
|
foreach($arraydata as $val)
|
||||||
|
{
|
||||||
|
$tmp=explode(':',$val);
|
||||||
|
$arraylist[$tmp[0]]=$tmp[1];
|
||||||
|
}
|
||||||
|
$ret.=$arraylist[$value];
|
||||||
|
}
|
||||||
else if (preg_match('/^ckeditor/',$typeofdata))
|
else if (preg_match('/^ckeditor/',$typeofdata))
|
||||||
{
|
{
|
||||||
$tmpcontent=dol_htmlentitiesbr($value);
|
$tmpcontent=dol_htmlentitiesbr($value);
|
||||||
|
|||||||
@ -2813,11 +2813,38 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update product/service type
|
||||||
|
*
|
||||||
|
* @param User $user Utilisateur qui fait la modification
|
||||||
|
* @return void
|
||||||
|
* TODO Replace this by a method update_field into common
|
||||||
|
*/
|
||||||
|
function update_type($user)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||||
|
$sql.= " SET fk_product_type = '".$this->type."'";
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::update_type sql=".$sql);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mise a jour du code barre
|
* Mise a jour du code barre
|
||||||
*
|
*
|
||||||
* @param User $user Utilisateur qui fait la modification
|
* @param User $user Utilisateur qui fait la modification
|
||||||
* @return void
|
* @return void
|
||||||
|
* TODO Replace this by a method update_field into common
|
||||||
*/
|
*/
|
||||||
function update_barcode($user)
|
function update_barcode($user)
|
||||||
{
|
{
|
||||||
@ -2843,6 +2870,7 @@ class Product extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user Utilisateur qui fait la modification
|
* @param User $user Utilisateur qui fait la modification
|
||||||
* @return void
|
* @return void
|
||||||
|
* TODO Replace this by a method update_field into common
|
||||||
*/
|
*/
|
||||||
function update_barcode_type($user)
|
function update_barcode_type($user)
|
||||||
{
|
{
|
||||||
@ -2871,14 +2899,7 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function isproduct()
|
function isproduct()
|
||||||
{
|
{
|
||||||
if ($this->type != 1)
|
return ($this->type != 1 ? true : false);
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2888,14 +2909,7 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function isservice()
|
function isservice()
|
||||||
{
|
{
|
||||||
if ($this->type==1)
|
return ($this->type == 1 ? true : false);
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -87,6 +87,17 @@ $error=$hookmanager->error; $errors=$hookmanager->errors;
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
// Type
|
||||||
|
if ($action == 'setproducttype' && $user->rights->produit->creer)
|
||||||
|
{
|
||||||
|
var_dump($action);
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->type = $_POST['producttype'];
|
||||||
|
$result = $object->update_type($user);
|
||||||
|
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// Barcode type
|
// Barcode type
|
||||||
if ($action == 'setbarcodetype' && $user->rights->barcode->creer)
|
if ($action == 'setbarcodetype' && $user->rights->barcode->creer)
|
||||||
{
|
{
|
||||||
@ -1078,6 +1089,15 @@ else
|
|||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Type
|
||||||
|
if ($conf->produit->enabled && $conf->service->enabled)
|
||||||
|
{
|
||||||
|
$typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
|
||||||
|
print '<tr><td>'.$form->editfieldkey("Type",'producttype',$object->type,$object,$user->rights->produit->creer|$user->rights->service->creer,$typeformat).'</td><td colspan="2">';
|
||||||
|
print $form->editfieldval("Type",'producttype',$object->type,$object,$user->rights->produit->creer|$user->rights->service->creer,$typeformat);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($showbarcode)
|
if ($showbarcode)
|
||||||
{
|
{
|
||||||
// Barcode type
|
// Barcode type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user