Fix: more clickless, remove "note" tab

This commit is contained in:
Regis Houssin
2012-03-12 17:47:55 +08:00
parent c18a5dfad0
commit e033f202d1
3 changed files with 48 additions and 26 deletions

View File

@@ -260,6 +260,20 @@ else if ($action == 'set_ref_client' && $user->rights->propale->creer)
$object->set_ref_client($user, $_POST['ref_client']);
}
else if ($action == 'setnote_public')
{
$object->fetch($id);
$result=$object->update_note_public(GETPOST('note_public','alpha'));
if ($result < 0) dol_print_error($db,$object->error);
}
else if ($action == 'setnote')
{
$object->fetch($id);
$result=$object->update_note(GETPOST('note','alpha'));
if ($result < 0) dol_print_error($db,$object->error);
}
// Create proposal
else if ($action == 'add' && $user->rights->propale->creer)
{
@@ -1184,8 +1198,6 @@ if ($id > 0 || ! empty($ref))
print '</td>';
print '</tr>';
$rowspan=11;
// Company
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>';
print '</tr>';
@@ -1251,20 +1263,6 @@ if ($id > 0 || ! empty($ref))
}
print '</td>';
if ($conf->projet->enabled) $rowspan++;
if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++;
//Local taxes
if ($mysoc->country_code=='ES')
{
if($mysoc->localtax1_assuj=="1") $rowspan++;
if($mysoc->localtax2_assuj=="1") $rowspan++;
}
// Notes
print '<td valign="top" colspan="2" width="50%" rowspan="'.$rowspan.'">'.$langs->trans('NotePublic').' :<br>'. nl2br($object->note_public).'</td>';
print '</tr>';
// Date end proposal
print '<tr>';
print '<td>';
@@ -1484,12 +1482,12 @@ if ($id > 0 || ! empty($ref))
// Amount HT
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" nowrap><b>'.price($object->total_ht).'</b></td>';
print '<td align="right" nowrap><b>'.price($object->total_ht).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Amount VAT
print '<tr><td height="10">'.$langs->trans('AmountVAT').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
print '<td align="right" nowrap>'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Amount Local Taxes
@@ -1498,24 +1496,44 @@ if ($id > 0 || ! empty($ref))
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
print '<td align="right" nowrap>'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
print '<td align="right" nowrap>'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
}
// Amount TTC
print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
print '<td align="right" nowrap>'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Statut
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$object->getLibStatut(4).'</td></tr>';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Notes').'</td></tr>';
// Public note
print '<tr><td valign="top">';
print $form->editfieldkey("NotePublic",'note_public',$object->note_public,$object,$user->rights->propale->creer,'textarea');
print '</td><td colspan="3">';
print $form->editfieldval("NotePublic",'note_public',$object->note_public,$object,$user->rights->propale->creer,'textarea');
print "</td></tr>";
// Private note
if (! $user->societe_id)
{
print '<tr><td valign="top">';
print $form->editfieldkey("NotePrivate",'note',$object->note_private,$object,$user->rights->propale->creer,'textarea');
print '</td><td colspan="3">';
print $form->editfieldval("NotePrivate",'note',$object->note_private,$object,$user->rights->propale->creer,'textarea');
print "</td></tr>";
}
print '</table><br>';
/*

View File

@@ -83,7 +83,8 @@ class Propal extends CommonObject
var $remise;
var $remise_percent;
var $remise_absolue;
var $note;
var $note; // deprecated (for compatibility)
var $note_private;
var $note_public;
var $fk_delivery_address; // deprecated (for compatibility)
var $fk_address;
@@ -954,7 +955,7 @@ class Propal extends CommonObject
$sql.= ", ca.code as availability_code, ca.label as availability";
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
$sql.= ", model_pdf, ref_client";
$sql.= ", note, note_public";
$sql.= ", note as note_private, note_public";
$sql.= ", fk_projet, fk_statut";
$sql.= ", fk_user_author, fk_user_valid, fk_user_cloture";
$sql.= ", fk_adresse_livraison";
@@ -999,13 +1000,14 @@ class Propal extends CommonObject
$this->socid = $obj->fk_soc;
$this->fk_project = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->note = $obj->note;
$this->note = $obj->note_private; // TODO obsolete
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->statut = $obj->fk_statut;
$this->statut_libelle = $obj->statut_label;
$this->datec = $this->db->jdate($obj->datec); //TODO obsolete
$this->datev = $this->db->jdate($obj->datev); //TODO obsolete
$this->datec = $this->db->jdate($obj->datec); // TODO obsolete
$this->datev = $this->db->jdate($obj->datev); // TODO obsolete
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date = $this->db->jdate($obj->dp); // Proposal date

View File

@@ -74,10 +74,12 @@ function propal_prepare_head($object)
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal');
/*
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;
*/
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
/*$filesdir = $conf->propale->dir_output . "/" . dol_sanitizeFileName($propal->ref);