NEW When creating order, proposal or invoice from thirdparty card, the

project is asked during creation. A link to create project if it does
not exists is also available.
NEW Uniformize form creation of proposal to add public and private notes
during creation like done for order and invoice.
This commit is contained in:
Laurent Destailleur 2015-06-03 11:55:39 +02:00
parent 912358f731
commit f7eaf35d30
6 changed files with 216 additions and 155 deletions

View File

@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
@ -305,7 +306,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->statut = Propal::STATUS_DRAFT;
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -331,7 +333,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@ -1256,6 +1259,7 @@ $formother = new FormOther($db);
$formfile = new FormFile($db);
$formpropal = new FormPropal($db);
$companystatic = new Societe($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$now = dol_now();
@ -1340,7 +1344,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Reference
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
print '<tr><td width="25%" class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
// Ref customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
@ -1444,13 +1448,20 @@ if ($action == 'create')
}
print '</td></tr>';
// Model
print '<tr>';
print '<td>' . $langs->trans("DefaultModel") . '</td>';
print '<td colspan="2">';
$liste = ModelePDFPropales::liste_modeles($db);
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
print "</td></tr>";
// Project
if (! empty($conf->projet->enabled) && $socid > 0)
{
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load("projects");
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>';
print '</tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled))
@ -1462,25 +1473,41 @@ if ($action == 'create')
print '</td></tr>';
}
// Project
if (! empty($conf->projet->enabled) && $socid > 0)
// Template to use by default
print '<tr>';
print '<td>' . $langs->trans("DefaultModel") . '</td>';
print '<td colspan="2">';
$liste = ModelePDFPropales::liste_modeles($db);
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
print "</td></tr>";
// Public note
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">';
$note_public = '';
if (is_object($objectsrc)) // Take value from source object
{
$formproject = new FormProjets($db);
$projectid = 0;
if ($origin == 'project')
$projectid = ($originid ? $originid : 0);
$note_public = $objectsrc->note_public;
}
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// Private note
if (empty($user->societe_id))
{
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
if ($numprojet == 0) {
$langs->load("projects");
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">';
$note_private = '';
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) // Take value from source object
{
$note_private = $objectsrc->note_private;
}
print '</td>';
print '</tr>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';
}
// Other attributes

View File

@ -1214,6 +1214,7 @@ llxHeader('', $langs->trans('Order'), 'EN:Customers_Orders|FR:Commandes_Clients|
$form = new Form($db);
$formfile = new FormFile($db);
$formorder = new FormOrder($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
/**
* *******************************************************************
@ -1320,7 +1321,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<table class="border" width="100%">';
// Reference
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
print '<tr><td width="25%" class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
// Reference client
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
@ -1422,14 +1423,16 @@ if ($action == 'create' && $user->rights->commande->creer)
// Project
if (! empty($conf->projet->enabled) && $socid > 0)
{
$formproject = new FormProjets($db);
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$langs->load("projects");
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
if ($numprojet == 0) {
print ' &nbsp; <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
}
print '</td></tr>';
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>';
print '</tr>';
}
// Incoterms
@ -1458,29 +1461,30 @@ if ($action == 'create' && $user->rights->commande->creer)
print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF);
print "</td></tr>";
// Note publique
// Note public
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';
// Note privee
// Note private
if (empty($user->societe_id)) {
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';
}
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
{
// TODO for compatibility
if ($origin == 'contrat') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
@ -1514,8 +1518,11 @@ if ($action == 'create' && $user->rights->commande->creer)
}
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
} else {
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) {
}
else
{
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE))
{
/*
* Services/produits predefinis
*/

View File

@ -1854,6 +1854,8 @@ $form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$bankaccountstatic = new Account($db);
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
$now = dol_now();
llxHeader('', $langs->trans('Bill'), 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
@ -2080,22 +2082,21 @@ if ($action == 'create')
}
print '<tr><td valign="top" class="fieldrequired">' . $langs->trans('Type') . '</td><td colspan="2">';
print '<table class="nobordernopadding">' . "\n";
print '<div class="tagtable">' . "\n";
// Standard invoice
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked' : '') . '>';
print '</td><td valign="middle">';
$desc = $form->textwithpicto($langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1);
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_standard" name="type" value="0"' . (GETPOST('type') == 0 ? ' checked' : '') . '> ';
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</td></tr>' . "\n";
print '</div></div>';
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
{
// Deposit
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '>';
print '</td><td valign="middle" class="nowrap">';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#typedeposit, #valuedeposit").click(function() {
@ -2103,9 +2104,13 @@ if ($action == 'create')
});
});
</script>';
$desc = $form->textwithpicto($langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1);
print '<table class="nobordernopadding"><tr><td>' . $desc . '</td>';
if (($origin == 'propal') || ($origin == 'commande')) {
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
print '<table class="nobordernopadding"><tr><td>';
print $desc;
print '</td>';
if (($origin == 'propal') || ($origin == 'commande'))
{
print '<td class="nowrap" style="padding-left: 5px">';
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
@ -2113,44 +2118,41 @@ if ($action == 'create')
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
}
print '</td></tr></table>';
print '</td></tr>' . "\n";
print '</div></div>';
}
if ($socid > 0)
{
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
// First situation invoice
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '>';
print '</td><td valign="middle">';
$desc = $form->textwithpicto($langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1);
print $desc;
print '</td></tr>' . "\n";
// First situation invoice
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 ? ' checked' : '') . '> ';
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceFirstSituationAsk"), $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
// Next situation invoice
$opt = $form->load_situation_invoices(GETPOST('originid'), $socid);
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 && GETPOST('originid') ? ' checked' : '') . ' ';
if ($opt == '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>' || (GETPOST('origin') && GETPOST('origin') != 'facture')) print 'disabled';
print '>';
print '</td><td valign="middle">';
$text = $langs->trans("InvoiceSituationAsk") . ' ';
$text .= '<select class="flat" id="situations" name="situations">';
$text .= $opt;
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1);
print $desc;
print '</td></tr>' . "\n";
// Next situation invoice
$opt = $form->load_situation_invoices(GETPOST('originid'), $socid);
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 && GETPOST('originid') ? ' checked' : '');
if ($opt == ('<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture')) $tmp.=' disabled';
$tmp.= '> ';
$text = $tmp.$langs->trans("InvoiceSituationAsk") . ' ';
$text .= '<select class="flat" id="situations" name="situations">';
$text .= $opt;
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
}
// Replacement
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
if (! $options)
print ' disabled';
print '>';
print '</td><td valign="middle">';
print '<!-- replacement line --><div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
if (! $options) $tmp.=' disabled';
$tmp.='> ';
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() {
@ -2158,7 +2160,7 @@ if ($action == 'create')
});
});
</script>';
$text = $langs->trans("InvoiceReplacementAsk") . ' ';
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
if (! $options)
$text .= ' disabled';
@ -2170,20 +2172,19 @@ if ($action == 'create')
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
}
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1);
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</td></tr>' . "\n";
print '</div></div>';
}
else
{
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" id="radio_replacement" value="0" disabled>';
print '</td><td valign="middle">';
$text = $langs->trans("InvoiceReplacement") . ' ';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
$text = $tmp.$langs->trans("InvoiceReplacement") . ' ';
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1);
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</td></tr>' . "\n";
print '</div></div>';
}
if (empty($origin))
@ -2191,12 +2192,10 @@ if ($action == 'create')
if ($socid > 0)
{
// Credit note
print '<tr height="18"><td valign="top">';
print '<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav)
print ' disabled';
print '>';
print '</td><td valign="top">';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
if (! $optionsav) $tmp.=' disabled';
$tmp.= '> ';
// Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
@ -2212,7 +2211,7 @@ if ($action == 'create')
});
});
</script>';
$text = $langs->transnoentities("InvoiceAvoirAsk") . ' ';
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
// $text.='<input type="text" value="">';
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
if (! $optionsav)
@ -2225,7 +2224,7 @@ if ($action == 'create')
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
}
$text .= '</select>';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1);
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc;
print '<div id="credit_note_options">';
@ -2233,22 +2232,22 @@ if ($action == 'create')
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>';
print '</td></tr>' . "\n";
print '</div></div>';
}
else
{
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" id="radio_creditnote" value="0" disabled>';
print '</td><td valign="middle">';
$text = $langs->trans("InvoiceAvoir") . ' ';
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
$text = $tmp.$langs->trans("InvoiceAvoir") . ' ';
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1);
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</td></tr>' . "\n";
print '</div></div>' . "\n";
}
}
print '</table>';
print '</div>';
print '</td></tr>';
if ($socid > 0)
@ -2293,12 +2292,15 @@ if ($action == 'create')
print '</td></tr>';
// Project
if (! empty($conf->projet->enabled) && $socid > 0) {
$formproject = new FormProjets($db);
if (! empty($conf->projet->enabled) && $socid > 0)
{
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$formproject->select_projects($soc->id, $projectid, 'projectid', 0);
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>';
}
@ -2320,7 +2322,7 @@ if ($action == 'create')
print $object->showOptionals($extrafields, 'edit');
}
// Modele PDF
// Template to use by default
print '<tr><td>' . $langs->trans('Model') . '</td>';
print '<td>';
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
@ -2337,7 +2339,7 @@ if ($action == 'create')
{
$note_public = $objectsrc->note_public;
}
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// Private note
@ -2351,7 +2353,7 @@ if ($action == 'create')
{
$note_private = $objectsrc->note_private;
}
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';
@ -2418,7 +2420,9 @@ if ($action == 'create')
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
}
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
} else {
}
else
{
// Show deprecated optional form to add product line here
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) {
print '<tr><td colspan="3">';
@ -3486,50 +3490,50 @@ if ($action == 'create')
// Show global modifiers
if (! empty($conf->global->INVOICE_US_SITUATION))
{
if ($object->situation_cycle_ref && $object->statut == 0) {
print '<tr class="liste_titre nodrag nodrop">';
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />';
print '<input type="hidden" name="action" value="updatealllines" />';
print '<input type="hidden" name="id" value="' . $object->id . '" />';
if ($object->situation_cycle_ref && $object->statut == 0) {
print '<tr class="liste_titre nodrag nodrop">';
print '<form name="updatealllines" id="updatealllines" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '"#updatealllines" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />';
print '<input type="hidden" name="action" value="updatealllines" />';
print '<input type="hidden" name="id" value="' . $object->id . '" />';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>';
}
print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
print '<td align="right" width="50">&nbsp;</td>';
print '<td align="right" width="80">&nbsp;</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">&nbsp;</td>';
print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
print '<td align="right" class="margininfos" width="80">&nbsp;</td>';
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) {
print '<td align="right" class="margininfos" width="50">&nbsp;</td>';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>';
}
}
print '<td align="right" width="50">&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print "</tr>\n";
print '<td>' . $langs->trans('ModifyAllLines') . '</td>';
print '<td align="right" width="50">&nbsp;</td>';
print '<td align="right" width="80">&nbsp;</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">&nbsp;</td>';
print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">&nbsp</td>';
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
if (! empty($conf->margin->enabled) && empty($user->societe_id))
{
print '<td align="right" class="margininfos" width="80">&nbsp;</td>';
if ((! empty($conf->global->DISPLAY_MARGIN_RATES) || ! empty($conf->global->DISPLAY_MARK_RATES)) && $user->rights->margins->liretous) {
print '<td align="right" class="margininfos" width="50">&nbsp;</td>';
}
}
print '<td align="right" width="50">&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print '<td width="10">&nbsp;</td>';
print "</tr>\n";
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td align="center" width="5">&nbsp;</td>';
}
print '<tr width="100%" class="nodrag nodrop">';
print '<td>&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td align="right" class="nowrap"><input type="text" size="1" value="" name="all_progress">%</td>';
print '<td colspan="4" align="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
print '</tr>';
print '</form>';
}
print '<tr width="100%" height="18" class="nodrag nodrop">';
print '<td>&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td width="50">&nbsp;</td>';
print '<td align="right" class="nowrap"><input type="text" size="1" value="" name="all_progress">%</td>';
print '<td colspan="4" align="right"><input class="button" type="submit" name="all_percent" value="Modifier" /></td>';
print '</tr>';
print '</form>';
}
}
// Show object lines

View File

@ -39,6 +39,7 @@ $ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha');
$backtopage=GETPOST('backtopage','alpha');
$cancel=GETPOST('cancel','alpha');
$status=GETPOST('status','int');
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden();
@ -139,6 +140,7 @@ if (empty($reshook))
$object->datec=dol_now();
$object->date_start=$date_start;
$object->date_end=$date_end;
$object->statuts = $status;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -167,8 +169,16 @@ if (empty($reshook))
{
$db->commit();
header("Location:card.php?id=".$object->id);
exit;
if ($backtopage)
{
header("Location: ".$backtopage.'&projectid='.$object->id);
exit;
}
else
{
header("Location:card.php?id=".$object->id);
exit;
}
}
else
{
@ -444,6 +454,15 @@ if ($action == 'create' && $user->rights->projet->creer)
else print $text;
print '</td></tr>';
// Status
if ($status != '')
{
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print '<input type="hidden" name="status" value="'.$status.'">';
print $object->LibStatut($status, 4);
print '</td></tr>';
}
// Public
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
$array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));

View File

@ -125,12 +125,12 @@ class Project extends CommonObject
$sql.= ", '" . $this->db->escape($this->description) . "'";
$sql.= ", " . ($this->socid > 0 ? $this->socid : "null");
$sql.= ", " . $user->id;
$sql.= ", 0";
$sql.= ", ".(is_numeric($this->statuts) ? $this->statuts : '0');
$sql.= ", " . ($this->public ? 1 : 0);
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", " . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
$sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql.= ", " . ($this->budget_amount != ''?price2num($this->budget_amount):'null');
$sql.= ", " . ($this->budget_amount != '' ? price2num($this->budget_amount) : 'null');
$sql.= ", ".$conf->entity;
$sql.= ")";

View File

@ -448,6 +448,10 @@ textarea.centpercent {
#formuserfile_link {
margin-left: 1px;
}
.listofinvoicetype {
height: 28px;
vertical-align: middle;
}
/* Style to move picto into left of button */
/*