mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Fix: Some fix when using fckeditor with notes.
Qual: Uniformize code to use new system for notes. Qual: Removed duplicate updatenote method into commandefournisseur class.
This commit is contained in:
@@ -249,14 +249,14 @@ else if ($action == 'set_ref_client' && $user->rights->propale->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,14 +50,14 @@ $object = new Propal($db);
|
||||
if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -482,14 +482,14 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,14 +57,14 @@ if (! $object->fetch($id, $ref) > 0)
|
||||
if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -313,14 +313,14 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@ $object->fetch($id);
|
||||
if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ if ($_POST["action"] == 'update_public' && $user->rights->contrat->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$contrat->update_note_public($_POST["note_public"],$user);
|
||||
$res=$contrat->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||
@@ -68,7 +68,7 @@ if ($_POST["action"] == 'update' && $user->rights->contrat->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$contrat->update_note($_POST["note"],$user);
|
||||
$res=$contrat->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$contrat->error.'</div>';
|
||||
|
||||
@@ -1390,7 +1390,8 @@ abstract class CommonObject
|
||||
dol_syslog(get_class($this)."::update_note sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->note = $note;
|
||||
$this->note = $note; // deprecated
|
||||
$this->note_private = $note;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3178,7 +3178,7 @@ function picto_required()
|
||||
function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
{
|
||||
$pattern = "/<[^>]+>/";
|
||||
$temp = dol_entity_decode($StringHtml,$pagecodeto);
|
||||
$temp = dol_html_entity_decode($StringHtml,ENT_COMPAT,$pagecodeto);
|
||||
$temp = preg_replace($pattern,"",$temp);
|
||||
|
||||
// Supprime aussi les retours
|
||||
@@ -3283,19 +3283,6 @@ function dol_htmlcleanlastbr($stringtodecode)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called to decode a string with HTML entities (it decodes entities tags)
|
||||
*
|
||||
* @param string $stringhtml stringhtml
|
||||
* @param string $pagecodeto Encoding of input string
|
||||
* @return string decodestring
|
||||
*/
|
||||
function dol_entity_decode($stringhtml,$pagecodeto='UTF-8')
|
||||
{
|
||||
$ret=dol_html_entity_decode($stringhtml,ENT_COMPAT,$pagecodeto);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace html_entity_decode functions to manage errors
|
||||
*
|
||||
@@ -3304,7 +3291,7 @@ function dol_entity_decode($stringhtml,$pagecodeto='UTF-8')
|
||||
* @param string $c Operand c
|
||||
* @return string String decoded
|
||||
*/
|
||||
function dol_html_entity_decode($a,$b,$c)
|
||||
function dol_html_entity_decode($a,$b,$c='UTF-8')
|
||||
{
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
$ret=@html_entity_decode($a,$b,$c);
|
||||
@@ -3319,7 +3306,7 @@ function dol_html_entity_decode($a,$b,$c)
|
||||
* @param string $c Operand c
|
||||
* @return string String encoded
|
||||
*/
|
||||
function dol_htmlentities($a,$b,$c)
|
||||
function dol_htmlentities($a,$b,$c='UTF-8')
|
||||
{
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
$ret=@htmlentities($a,$b,$c);
|
||||
|
||||
@@ -19,8 +19,14 @@
|
||||
$module = $object->element;
|
||||
$note_public = 'note_public';
|
||||
$note_private = 'note';
|
||||
if ($module == 'propal') $module = 'propale';
|
||||
$colwidth=(empty($colwidth)?25:$colwidth);
|
||||
$permission=$user->rights->$module->creer;
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') { $module = 'propale'; }
|
||||
elseif ($module == 'fichinter') { $module = 'ficheinter'; $note_private = 'note_private'; }
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
|
||||
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200:1:12:100';
|
||||
else $typeofdata='textarea:12:100';
|
||||
@@ -29,13 +35,13 @@ else $typeofdata='textarea:12:100';
|
||||
<!-- BEGIN PHP TEMPLATE NOTES -->
|
||||
<div class="table-border">
|
||||
<div class="table-border-row">
|
||||
<div class="table-key-border-col"><?php echo $form->editfieldkey("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,$typeofdata); ?></div>
|
||||
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic",$note_public,$object->note_public,$object,$user->rights->$module->creer,$typeofdata); ?></div>
|
||||
<div class="table-key-border-col"<?php echo ' style="width: '.$colwidth.'%"'; ?>><?php echo $form->editfieldkey("NotePublic",$note_public,$object->note_public,$object,$permission,$typeofdata); ?></div>
|
||||
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic",$note_public,$object->note_public,$object,$permission,$typeofdata); ?></div>
|
||||
</div>
|
||||
<?php if (! $user->societe_id) { ?>
|
||||
<div class="table-border-row">
|
||||
<div class="table-key-border-col"><?php echo $form->editfieldkey("NotePrivate",$note_private,$object->note_private,$object,$user->rights->$module->creer,$typeofdata); ?></div>
|
||||
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate",$note_private,$object->note_private,$object,$user->rights->$module->creer,$typeofdata); ?></div>
|
||||
<div class="table-key-border-col"<?php echo ' style="width: '.$colwidth.'%"'; ?>><?php echo $form->editfieldkey("NotePrivate",$note_private,$object->note_private,$object,$permission,$typeofdata); ?></div>
|
||||
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate",$note_private,$object->note_private,$object,$permission,$typeofdata); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
@@ -221,13 +221,13 @@ else if ($action == 'setdescription' && $user->rights->ficheinter->creer)
|
||||
else if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note_private','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ $object = new Fichinter($db);
|
||||
if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(GETPOST('note_public','alpha'));
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(GETPOST('note','alpha'));
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class CommandeFournisseur extends Commande
|
||||
$sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
|
||||
$sql.= " c.localtax1, c.localtax2, ";
|
||||
$sql.= " c.date_commande as date_commande, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
|
||||
$sql.= " c.note, c.note_public, c.model_pdf,";
|
||||
$sql.= " c.note as note_private, c.note_public, c.model_pdf,";
|
||||
$sql.= " cm.libelle as methode_commande,";
|
||||
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
|
||||
$sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle";
|
||||
@@ -162,7 +162,8 @@ class CommandeFournisseur extends Commande
|
||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||
$this->mode_reglement = $obj->mode_reglement_libelle;
|
||||
$this->note = $obj->note;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
|
||||
@@ -271,7 +272,7 @@ class CommandeFournisseur extends Commande
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("FournisseurCommande::log ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::log ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1404,46 +1405,6 @@ class CommandeFournisseur extends Commande
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update notes
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param string $note Private note
|
||||
* @param string $note_public Public note
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*
|
||||
* TODO Use instead update_note_public and update_note
|
||||
*/
|
||||
function UpdateNote($user, $note, $note_public)
|
||||
{
|
||||
// Clean parameters
|
||||
$note=trim($note);
|
||||
$note_public=trim($note_public);
|
||||
|
||||
$result = 0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||
$sql.= " SET note ='".$this->db->escape($note)."',";
|
||||
$sql.= " note_public ='".$this->db->escape($note_public)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::UpdateNote sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this)."::UpdateNote ".$this->error, LOG_ERR);
|
||||
$result = -1;
|
||||
}
|
||||
|
||||
return $result ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag order with a particular status
|
||||
*
|
||||
@@ -1462,7 +1423,7 @@ class CommandeFournisseur extends Commande
|
||||
$sql.= ' SET fk_statut='.$status;
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog("CommandeFournisseur::setStatus sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setStatus sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1472,7 +1433,7 @@ class CommandeFournisseur extends Commande
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("CommandeFournisseur::setStatus ".$this->error);
|
||||
dol_syslog(get_class($this)."::setStatus ".$this->error);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@@ -1505,7 +1466,7 @@ class CommandeFournisseur extends Commande
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0)
|
||||
{
|
||||
dol_syslog("CommandeFournisseur::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
|
||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
|
||||
|
||||
if ($this->brouillon)
|
||||
|
||||
@@ -283,7 +283,7 @@ class FactureFournisseur extends Facture
|
||||
$sql.= " t.fk_projet,";
|
||||
$sql.= " t.fk_cond_reglement,";
|
||||
$sql.= " t.date_lim_reglement,";
|
||||
$sql.= " t.note,";
|
||||
$sql.= " t.note as note_private,";
|
||||
$sql.= " t.note_public,";
|
||||
$sql.= " t.model_pdf,";
|
||||
$sql.= " t.import_key,";
|
||||
@@ -336,7 +336,8 @@ class FactureFournisseur extends Facture
|
||||
$this->fk_project = $obj->fk_projet;
|
||||
$this->fk_cond_reglement = $obj->fk_cond_reglement;
|
||||
$this->date_echeance = $this->db->jdate($obj->date_lim_reglement);
|
||||
$this->note = $obj->note;
|
||||
$this->note = $obj->note_private;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
@@ -32,27 +32,31 @@ $langs->load("suppliers");
|
||||
$langs->load("companies");
|
||||
$langs->load('stocks');
|
||||
|
||||
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
$action = GETPOST('action');
|
||||
|
||||
// Security check
|
||||
$id = isset($_GET["id"])?$_GET["id"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'commande_fournisseur', $id,'');
|
||||
|
||||
$object = new CommandeFournisseur($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
|
||||
if ($action == 'setnote_public' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->fetch($_GET["id"]);
|
||||
|
||||
$result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: note.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,21 +76,17 @@ $form = new Form($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$id = $_GET['id'];
|
||||
$ref= $_GET['ref'];
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$result=$commande->fetch($_GET["id"],$_GET['ref']);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($commande->socid);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($commande->user_author_id);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
$head = ordersupplier_prepare_head($commande);
|
||||
$head = ordersupplier_prepare_head($object);
|
||||
|
||||
$title=$langs->trans("SupplierOrder");
|
||||
dol_fiche_head($head, 'note', $title, 0, 'order');
|
||||
@@ -95,16 +95,12 @@ if ($id > 0 || ! empty($ref))
|
||||
/*
|
||||
* Commande
|
||||
*/
|
||||
print '<form action="note.php?id='.$commande->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updatenote">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($commande,'ref','',1,'ref','ref');
|
||||
print $form->showrefnav($object,'ref','',1,'ref','ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -117,55 +113,36 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $commande->getLibStatut(4);
|
||||
print $object->getLibStatut(4);
|
||||
print "</td></tr>";
|
||||
|
||||
// Date
|
||||
if ($commande->methode_commande_id > 0)
|
||||
if ($object->methode_commande_id > 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
if ($commande->date_commande)
|
||||
if ($object->date_commande)
|
||||
{
|
||||
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
|
||||
print dol_print_date($object->date_commande,"dayhourtext")."\n";
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
if ($commande->methode_commande)
|
||||
if ($object->methode_commande)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->methode_commande.'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Auteur
|
||||
// Author
|
||||
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
|
||||
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">';
|
||||
print $commande->note_public;
|
||||
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_8.'" name="note">';
|
||||
print $commande->note;
|
||||
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<center><br><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print "</form>";
|
||||
$colwidth=20;
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
@@ -178,7 +155,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@@ -31,15 +31,16 @@ require_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
|
||||
$langs->load('bills');
|
||||
$langs->load("companies");
|
||||
|
||||
$facid = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
|
||||
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
$action = GETPOST('action');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture');
|
||||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
|
||||
|
||||
$object = new FactureFournisseur($db);
|
||||
$object->fetch($facid);
|
||||
$object->fetch($id,$ref);
|
||||
|
||||
|
||||
|
||||
@@ -47,42 +48,20 @@ $object->fetch($facid);
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($action == 'update_public' && $user->rights->facture->creer)
|
||||
if ($action == 'setnote_public' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$object->update_note_public($_POST["note_public"],$user);
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$db->rollback();
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
else
|
||||
elseif ($action == 'setnote' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$object->update_note($_POST["note"],$user);
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
// Set label
|
||||
if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($facid);
|
||||
$object->label=$_POST['label'];
|
||||
$result=$object->update($user);
|
||||
if ($result < 0) dol_print_error($db);
|
||||
@@ -97,7 +76,7 @@ $form = new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($facid)
|
||||
if ($id)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@@ -142,12 +121,12 @@ if ($facid)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i=0;
|
||||
foreach($facidavoir as $id)
|
||||
foreach($facidavoir as $fid)
|
||||
{
|
||||
if ($i==0) print ' ';
|
||||
else print ',';
|
||||
$facavoir=new FactureFournisseur($db);
|
||||
$facavoir->fetch($id);
|
||||
$facavoir->fetch($fid);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
@@ -165,65 +144,18 @@ if ($facid)
|
||||
print $form->editfieldval("Label",'label',$object->label,$object,0);
|
||||
print '</td>';
|
||||
|
||||
// Note public
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update_public">';
|
||||
print '<textarea name="note_public" cols="80" rows="8">'.$object->note_public."</textarea><br>";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($object->note_public?nl2br($object->note_public):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
// Note private
|
||||
if (! $user->societe_id)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
if ($_GET["action"] == 'edit')
|
||||
{
|
||||
print '<form method="post" action="note.php?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<textarea name="note" cols="80" rows="8">'.$object->note."</textarea><br>";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ($object->note?nl2br($object->note):" ");
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
$colwidth=20;
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Buttons
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?facid=$object->id&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@@ -52,7 +52,7 @@ if ($action == 'update_public' && $user->rights->projet->creer)
|
||||
|
||||
$db->begin();
|
||||
|
||||
$res=$project->update_note_public($_POST["note_public"],$user);
|
||||
$res=$project->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$project->error.'</div>';
|
||||
@@ -71,7 +71,7 @@ if ($action == 'update_private' && $user->rights->projet->creer)
|
||||
|
||||
$db->begin();
|
||||
|
||||
$res=$project->update_note($_POST["note_private"],$user);
|
||||
$res=$project->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$project->error.'</div>';
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($action == 'update_public' && $user->rights->projet->creer)
|
||||
|
||||
$db->begin();
|
||||
|
||||
$res=$task->update_note_public($_POST["note_public"],$user);
|
||||
$res=$task->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$task->error.'</div>';
|
||||
@@ -73,7 +73,7 @@ if ($action == 'update_private' && $user->rights->projet->creer)
|
||||
|
||||
$db->begin();
|
||||
|
||||
$res=$task->update_note($_POST["note_private"],$user);
|
||||
$res=$task->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$task->error.'</div>';
|
||||
|
||||
Reference in New Issue
Block a user