New: Can create proposal from an intervention.

This commit is contained in:
Laurent Destailleur 2014-06-28 19:47:51 +02:00
parent 0e36295e12
commit 03c6d8fdc3
5 changed files with 330 additions and 58 deletions

View File

@ -5,8 +5,8 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
New: [ task #867 ] Remove ESAEB external module code from core
-
New: [ task #867 ] Remove ESAEB external module code from core.
New: Can create proposal from an intervention.
For translators:
- Update language files.

View File

@ -237,11 +237,13 @@ else if ($action == 'add' && $user->rights->propal->creer) {
$error ++;
}
if (! $error) {
if (! $error)
{
$db->begin();
// Si on a selectionne une propal a copier, on realise la copie
if (GETPOST('createmode') == 'copy' && GETPOST('copie_propal')) {
if (GETPOST('createmode') == 'copy' && GETPOST('copie_propal'))
{
if ($object->fetch(GETPOST('copie_propal')) > 0) {
$object->ref = GETPOST('ref');
$object->datep = $datep;
@ -287,7 +289,8 @@ else if ($action == 'add' && $user->rights->propal->creer) {
$object->origin = GETPOST('origin');
$object->origin_id = GETPOST('originid');
for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++) {
for($i = 1; $i <= $conf->global->PRODUCT_SHOW_WHEN_CREATE; $i ++)
{
if ($_POST ['idprod' . $i]) {
$xid = 'idprod' . $i;
$xqty = 'qty' . $i;
@ -304,8 +307,137 @@ else if ($action == 'add' && $user->rights->propal->creer) {
}
}
if (! $error) {
$id = $object->create($user);
if (! $error)
{
if ($origin && $originid)
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
}
// For compatibility
if ($element == 'order') {
$element = $subelement = 'commande';
}
if ($element == 'propal') {
$element = 'comm/propal';
$subelement = 'propal';
}
if ($element == 'contract') {
$element = $subelement = 'contrat';
}
if ($element == 'inter') {
$element = $subelement = 'ficheinter';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
}
$object->origin = $origin;
$object->origin_id = $originid;
// Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id;
if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) {
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
}
$id = $object->create($user);
if ($id > 0)
{
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement);
$srcobject = new $classname($db);
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
$result = $srcobject->fetch($object->origin_id);
if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0;
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
// Positive line
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Date start
$date_start = false;
if ($lines[$i]->date_debut_prevue)
$date_start = $lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel)
$date_start = $lines[$i]->date_debut_reel;
if ($lines[$i]->date_start)
$date_start = $lines[$i]->date_start;
// Date end
$date_end = false;
if ($lines[$i]->date_fin_prevue)
$date_end = $lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel)
$date_end = $lines[$i]->date_fin_reel;
if ($lines[$i]->date_end)
$date_end = $lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option = $lines[$i]->array_options;
}
$tva_tx=get_default_tva($mysoc, $object->thirdparty);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_option);
if ($result > 0) {
$lineid = $result;
} else {
$lineid = 0;
$error ++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// Hooks
$parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0)
$error ++;
} else {
$mesgs [] = $srcobject->error;
$error ++;
}
} else {
$mesgs [] = $object->error;
$error ++;
}
} // Standard creation
else
{
$id = $object->create($user);
}
if ($id > 0) {
// Insertion contact par defaut si defini
@ -1105,6 +1237,61 @@ if ($action == 'create') {
if ($socid > 0)
$res = $soc->fetch($socid);
// Load objectsrc
if (! empty($origin) && ! empty($originid))
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
}
if ($element == 'project') {
$projectid = $originid;
} else {
// For compatibility
if ($element == 'order' || $element == 'commande') {
$element = $subelement = 'commande';
}
if ($element == 'propal') {
$element = 'comm/propal';
$subelement = 'propal';
}
if ($element == 'contract') {
$element = $subelement = 'contrat';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
}
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))
$objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
$soc = $objectsrc->thirdparty;
$cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice);
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options;
}
}
$object = new Propal($db);
print '<form name="addprop" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
@ -1243,16 +1430,62 @@ if ($action == 'create') {
print $object->showOptionals($extrafields, 'edit');
}
print "</table>";
// Lines from source
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
{
// TODO for compatibility
if ($origin == 'contrat') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
$objectsrc->remise_absolue = $remise_absolue;
$objectsrc->remise_percent = $remise_percent;
$objectsrc->update_price(1, - 1, 1);
}
print "\n<!-- " . $classname . " info -->";
print "\n";
print '<input type="hidden" name="amount" value="' . $objectsrc->total_ht . '">' . "\n";
print '<input type="hidden" name="total" value="' . $objectsrc->total_ttc . '">' . "\n";
print '<input type="hidden" name="tva" value="' . $objectsrc->total_tva . '">' . "\n";
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
$newclassname = $classname;
if ($newclassname == 'Propal')
$newclassname = 'CommercialProposal';
elseif ($newclassname == 'Commande')
$newclassname = 'Order';
elseif ($newclassname == 'Expedition')
$newclassname = 'Sending';
elseif ($newclassname == 'Fichinter')
$newclassname = 'Intervention';
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
if ($mysoc->localtax1_assuj == "1") // Localtax1 RE
{
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>";
}
if ($mysoc->localtax2_assuj == "1") // Localtax2 IRPF
{
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>";
}
print "</table>\n";
print '<br>';
/*
* Combobox pour la fonction de copie
*/
if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
print '<input type="hidden" name="createmode" value="empty">';
}
if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print '<input type="hidden" name="createmode" value="empty">';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '<table>';
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
@ -1296,7 +1529,8 @@ if ($action == 'create') {
print '<td valign="top" colspan="2">' . $langs->trans("CreateEmptyPropal") . '</td></tr>';
}
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) {
if (! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE))
{
print '<tr><td colspan="3">';
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) {
$lib = $langs->trans("ProductsAndServices");
@ -1325,6 +1559,7 @@ if ($action == 'create') {
}
if (! empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE) || ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE)) print '</table><br>';
$langs->load("bills");
print '<center>';
print '<input type="submit" class="button" value="' . $langs->trans("CreateDraft") . '">';
@ -1332,6 +1567,22 @@ if ($action == 'create') {
print '</center>';
print "</form>";
// Show origin lines
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
print '<br>';
$title = $langs->trans('ProductsAndServices');
print_titre($title);
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList();
print '</table>';
}
} else {
/*
* Show object in view mode
@ -1982,7 +2233,7 @@ if ($action == 'create') {
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname'];
// Define output language
$outputlangs = $langs;
$newlang = '';
@ -1990,16 +2241,16 @@ if ($action == 'create') {
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->client->default_lang;
// Build document if it not exists
if (! $file || ! is_readable($file)) {
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$result = propale_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $result);

View File

@ -802,11 +802,11 @@ else if ($action == 'add' && $user->rights->facture->creer)
$object->fetch_thirdparty();
// If creation from another object of another module (Example: origin=propal, originid=1)
if ($_POST['origin'] && $_POST['originid'])
if ($origin && $originid)
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) {
$element = $subelement = $origin;
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
}
@ -829,8 +829,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
$element = $subelement = 'expedition';
}
$object->origin = $_POST['origin'];
$object->origin_id = $_POST['originid'];
$object->origin = $origin;
$object->origin_id = $originid;
// Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id;
@ -889,19 +889,19 @@ else if ($action == 'add' && $user->rights->facture->creer)
$langs->trans('Deposit'),
$amountdeposit, // subprice
1, // quantity
$lines [$i]->tva_tx, 0, // localtax1_tx
$lines[$i]->tva_tx, 0, // localtax1_tx
0, // localtax2_tx
0, // fk_product
0, // remise_percent
0, // date_start
0, // date_end
0, $lines [$i]->info_bits, // info_bits
0, $lines[$i]->info_bits, // info_bits
0, // info_bits
'HT',
0,
0, // product_type
1,
$lines [$i]->special_code,
$lines[$i]->special_code,
$object->origin,
0,
0,
@ -932,15 +932,15 @@ else if ($action == 'add' && $user->rights->facture->creer)
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
if ($lines [$i]->subprice < 0)
if ($lines[$i]->subprice < 0)
{
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->fk_soc = $object->socid;
$discount->amount_ht = abs($lines [$i]->total_ht);
$discount->amount_tva = abs($lines [$i]->total_tva);
$discount->amount_ttc = abs($lines [$i]->total_ttc);
$discount->tva_tx = $lines [$i]->tva_tx;
$discount->amount_ht = abs($lines[$i]->total_ht);
$discount->amount_tva = abs($lines[$i]->total_tva);
$discount->amount_ttc = abs($lines[$i]->total_ttc);
$discount->tva_tx = $lines[$i]->tva_tx;
$discount->fk_user = $user->id;
$discount->description = $desc;
$discountid = $discount->create($user);
@ -953,38 +953,38 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
} else {
// Positive line
$product_type = ($lines [$i]->product_type ? $lines [$i]->product_type : 0);
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
// Date start
$date_start = false;
if ($lines [$i]->date_debut_prevue)
$date_start = $lines [$i]->date_debut_prevue;
if ($lines [$i]->date_debut_reel)
$date_start = $lines [$i]->date_debut_reel;
if ($lines [$i]->date_start)
$date_start = $lines [$i]->date_start;
if ($lines[$i]->date_debut_prevue)
$date_start = $lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel)
$date_start = $lines[$i]->date_debut_reel;
if ($lines[$i]->date_start)
$date_start = $lines[$i]->date_start;
// Date end
$date_end = false;
if ($lines [$i]->date_fin_prevue)
$date_end = $lines [$i]->date_fin_prevue;
if ($lines [$i]->date_fin_reel)
$date_end = $lines [$i]->date_fin_reel;
if ($lines [$i]->date_end)
$date_end = $lines [$i]->date_end;
if ($lines[$i]->date_fin_prevue)
$date_end = $lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel)
$date_end = $lines[$i]->date_fin_reel;
if ($lines[$i]->date_end)
$date_end = $lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product
if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) {
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines [$i], 'fetch_optionals')) {
$lines [$i]->fetch_optionals($lines [$i]->rowid);
$array_option = $lines [$i]->array_options;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_option = $lines[$i]->array_options;
}
$result = $object->addline($desc, $lines [$i]->subprice, $lines [$i]->qty, $lines [$i]->tva_tx, $lines [$i]->localtax1_tx, $lines [$i]->localtax2_tx, $lines [$i]->fk_product, $lines [$i]->remise_percent, $date_start, $date_end, 0, $lines [$i]->info_bits, $lines [$i]->fk_remise_except, 'HT', 0, $product_type, $lines [$i]->rang, $lines [$i]->special_code, $object->origin, $lines [$i]->rowid, $fk_parent_line, $lines [$i]->fk_fournprice, $lines [$i]->pa_ht, $label, $array_option);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option);
if ($result > 0) {
$lineid = $result;
@ -995,7 +995,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
// Defined the new fk_parent_line
if ($result > 0 && $lines [$i]->product_type == 9) {
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
@ -1841,6 +1841,7 @@ if ($action == 'create')
if ($socid > 0)
$res = $soc->fetch($socid);
// Load objectsrc
if (! empty($origin) && ! empty($originid))
{
// Parse element/subelement (ex: project_task)
@ -2252,10 +2253,9 @@ if ($action == 'create')
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
// print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea></td></tr>';
// Private note
if (empty($user->societe_id)) {
if (empty($user->societe_id))
{
print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">';
@ -2266,10 +2266,13 @@ if ($action == 'create')
}
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea></td></tr>';
// print '<textarea name="note_private" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'.</textarea>
print '</td></tr>';
}
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
// Lines from source
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
{
// TODO for compatibility
if ($origin == 'contrat') {
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
@ -2293,6 +2296,8 @@ if ($action == 'create')
$newclassname = 'Order';
elseif ($newclassname == 'Expedition')
$newclassname = 'Sending';
elseif ($newclassname == 'Fichinter')
$newclassname = 'Intervention';
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
@ -2362,7 +2367,10 @@ if ($action == 'create')
print "</table>\n";
// Button "Create Draft"
print '<br><center><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '"></center>';
print '<br><center>';
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
print '&nbsp;<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</center>';
print "</form>\n";
@ -3620,7 +3628,7 @@ if ($action == 'create')
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname'];
// Define output language
$outputlangs = $langs;
$newlang = '';
@ -3631,7 +3639,7 @@ if ($action == 'create')
// Build document if it not exists
if (! $file || ! is_readable($file)) {
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);

View File

@ -1115,6 +1115,7 @@ class Form
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @return string HTML select string
* @see select_dolgroups
*/
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0)
{
@ -4196,6 +4197,7 @@ class Form
* @param int $enableonly Array list of groups id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force
* @return void
* @see select_dolusers
*/
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0)
{

View File

@ -1543,6 +1543,17 @@ else if ($id > 0 || ! empty($ref))
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
}
// Proposal
if (! empty($conf->propal->enabled) && $object->statut > 0)
{
$langs->load("propal");
if ($object->statut < 2)
{
if ($user->rights->propal->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddProp").'</a></div>';
}
}
// Invoicing
if (! empty($conf->facture->enabled) && $object->statut > 0)
{
@ -1582,7 +1593,7 @@ else if ($id > 0 || ! empty($ref))
/*
* Built documents
*/
*/
$filename=dol_sanitizeFileName($object->ref);
$filedir=$conf->ficheinter->dir_output . "/".$object->ref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
@ -1616,7 +1627,7 @@ else if ($id > 0 || ! empty($ref))
/*
* Action presend
*/
*/
if ($action == 'presend')
{
$ref = dol_sanitizeFileName($object->ref);