mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Add public note on products. This also partially fix the #14342
This commit is contained in:
parent
7239232528
commit
7149cbb532
|
|
@ -2847,12 +2847,14 @@ abstract class CommonObject
|
|||
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
|
||||
$newsuffix = $suffix;
|
||||
|
||||
// Special cas
|
||||
//var_dump($this->table_element);exit;
|
||||
if ($this->table_element == 'product') $suffix = '';
|
||||
if ($this->table_element == 'product' && $newsuffix == '_private') $newsuffix = '';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " SET note".$suffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
|
||||
$sql .= " SET note".$newsuffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
|
||||
$sql .= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment')) ? "fk_user_mod" : "fk_user_modif")." = ".$user->id;
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,17 +87,14 @@ else $typeofdata = 'textarea:12:95%';
|
|||
|
||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
|
||||
if ($module != 'product') {
|
||||
// No public note yet on products
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
|
||||
print '</div>'."\n";
|
||||
print '<div class="tagtd table-val-border-col sensiblehtmlcontent">'."\n";
|
||||
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
|
||||
print '</div>'."\n";
|
||||
print '</div>'."\n";
|
||||
}
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
print '<div class="tagtd tagtdnote tdtop sensiblehtmlcontent table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
|
||||
print '</div>'."\n";
|
||||
print '<div class="tagtd table-val-border-col sensiblehtmlcontent">'."\n";
|
||||
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
|
||||
print '</div>'."\n";
|
||||
print '</div>'."\n";
|
||||
if (empty($user->socid)) {
|
||||
// Private notes (always hidden to external users)
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
|
|
|
|||
|
|
@ -2025,7 +2025,7 @@ class Product extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,";
|
||||
$sql = "SELECT rowid, ref, ref_ext, label, description, url, note_public, note as note_private, customcode, fk_country, price, price_ttc,";
|
||||
$sql .= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
|
||||
$sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,";
|
||||
$sql .= " length, length_units, width, width_units, height, height_units,";
|
||||
|
|
@ -2061,8 +2061,9 @@ class Product extends CommonObject
|
|||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->url = $obj->url;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
|
||||
$this->type = $obj->fk_product_type;
|
||||
$this->status = $obj->tosell;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user