- New: Enable feature developed for 3.6 we forgot to enabled: Adding

prefix on uploaded file names. 
- New: No more dependency between contract and service module.
This commit is contained in:
Laurent Destailleur 2014-07-19 22:05:35 +02:00
parent b42a33b203
commit 04a20d2008
7 changed files with 59 additions and 33 deletions

View File

@ -5,6 +5,9 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
- New: Enable feature developed for 3.6 we forgot to enabled: Adding prefix
on uploaded file names.
- New: No more dependency between contract and service module.
- New: [ task #867 ] Remove ESAEB external module code from core.
- New: Can create proposal from an intervention.
- New: Can filter events on a group of users.

View File

@ -544,7 +544,7 @@ class Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
* @param string $forceall Force to show products and services in combo list, whatever are activated modules
* @param string $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service')
* @return void
*/
function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0)
@ -552,8 +552,8 @@ class Form
global $db,$langs,$user,$conf;
// If product & services are enabled or both disabled.
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|| (empty($conf->product->enabled) && empty($conf->service->enabled)))
if ($forceall > 0 || (empty($forceall) && ! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|| (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled)) )
{
if (empty($hidetext)) print $langs->trans("Type").': ';
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
@ -575,17 +575,20 @@ class Form
print '</select>';
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
}
if (! $forceall && empty($conf->product->enabled) && ! empty($conf->service->enabled))
if (empty($forceall) && empty($conf->product->enabled) && ! empty($conf->service->enabled))
{
print $langs->trans("Service");
print '<input type="hidden" name="'.$htmlname.'" value="1">';
}
if (! $forceall && ! empty($conf->product->enabled) && empty($conf->service->enabled))
if (empty($forceall) && ! empty($conf->product->enabled) && empty($conf->service->enabled))
{
print $langs->trans("Product");
print '<input type="hidden" name="'.$htmlname.'" value="0">';
}
if ($forceall < 0) // This should happened only for contracts when both predefined product and service are disabled.
{
print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
}
}
/**

View File

@ -60,7 +60,7 @@ class modContrat extends DolibarrModules
$this->dirs = array("/contract/temp");
// Dependances
$this->depends = array("modSociete","modService");
$this->depends = array("modSociete");
$this->requiredby = array();
// Config pages

View File

@ -64,7 +64,7 @@ class modService extends DolibarrModules
// Dependancies
$this->depends = array();
$this->requiredby = array("modContrat");
$this->requiredby = array();
// Config pages
$this->config_page_url = array("product.php@product");

View File

@ -41,6 +41,21 @@ if ($action == 'delete')
$formfile=new FormFile($db);
// We define var to enable the feature to add prefix of uploaded files
$savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
{
//var_dump($modulepart);
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','ficheinter','contract','project','project_task')))
{
$savingdocmask=$object->ref.'___file__';
}
/*if (in_array($modulepart,array('member')))
{
$savingdocmask=$object->login.'___file__';
}*/
}
// Show upload form (document and links)
$formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject)?'':'&withproject=1'),
@ -49,7 +64,10 @@ $formfile->form_attach_new_file(
0,
$permission,
50,
$object
$object,
'',
1,
$savingdocmask
);
// List of document

View File

@ -19,12 +19,17 @@
// Variable $upload_dir must be defined when entering here
// Send file/link
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) {
dol_add_file_process($upload_dir, 0, 1, 'userfile');
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($object->id)
{
dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask'));
}
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) {
}
elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if ($object->id)
{
$link = GETPOST('link', 'alpha');
if ($link)
{

View File

@ -91,10 +91,17 @@ else {
<?php
$forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service)
if ($object->element == 'contrat')
{
if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set
else $forceall=0;
}
// Free line
echo '<span>';
// Show radio free line
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{
echo '<input type="radio" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked="true"' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked="true"':'') );
@ -102,35 +109,25 @@ else {
echo '> ';
}
else echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// Show type selector
/* if (empty($conf->product->enabled) && empty($conf->service->enabled))
if ($forceall >= 0)
{
// If module product and service disabled, by default this is a product except for contracts it is a service
print '<input type="hidden" name="type" value="'.((! empty($object->element) && $object->element == 'contrat')?'1':'0').'">';
}
else {*/
echo '<label for="select_type">';
echo $langs->trans("FreeLineOfType");
echo '</label>';
/*
if (empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans("Type");
else if (! empty($forceall) || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))) echo $langs->trans("FreeLineOfType");
else if (empty($conf->product->enabled) && ! empty($conf->service->enabled)) echo $langs->trans("FreeLineOfType").' '.$langs->trans("Service");
else if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans("FreeLineOfType").' '.$langs->trans("Product");*/
echo ' ';
$forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service)
if ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))
{
$forceall=0;
}
echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,$forceall);
// }
}
echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,$forceall);
echo '</span>';
// Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
echo '<br><span>';
if ($forceall >= 0) echo '<br>';
echo '<span>';
echo '<input type="radio" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked="true"':'').'> ';
echo '<label for="prod_entry_mode_predef">';