This commit is contained in:
Raphaël Doursenaud 2012-05-29 10:18:39 +02:00
commit 76f8d1d37c
17 changed files with 39 additions and 29 deletions

View File

@ -209,7 +209,7 @@ if ($id > 0)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/adherents/document.php?id='.$member->id,'',0,0,$user->rights->adherent->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/adherents/document.php?id='.$member->id,'',0,0,$user->rights->adherent->creer,50,$object);
// List of document

View File

@ -187,7 +187,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
// List of document

View File

@ -172,7 +172,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/commande/document.php?id='.$object->id,'',0,0,$user->rights->commande->creer,50,$object);
// List of document

View File

@ -191,7 +191,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id,'',0,0,$user->rights->facture->creer,50,$object);
// List of document

View File

@ -156,7 +156,7 @@ if ($contrat->id)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id,'',0,0,$user->rights->contrat->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id,'',0,0,$user->rights->contrat->creer,50,$object);
// List of document

View File

@ -43,8 +43,9 @@ error_reporting(E_ALL | E_STRICT);
//print_r($_GET);
//print 'upload_dir='.GETPOST('upload_dir');
$fk_element = GETPOST('fk_element');
$element = GETPOST('element');
$fk_element = GETPOST('fk_element','int');
$element = GETPOST('element','alpha');
$element_ref=GETPOST('element_ref','alpha');
/**
@ -56,6 +57,7 @@ class UploadHandler
private $_options;
private $_fk_element;
private $_element;
private $_element_ref;
/**
@ -64,19 +66,21 @@ class UploadHandler
* @param array $options Options array
* @param int $fk_element fk_element
* @param string $element element
* @param string $element_ref element ref
*/
function __construct($options=null,$fk_element=null,$element=null)
function __construct($options=null,$fk_element=null,$element=null,$element_ref=null)
{
global $conf;
$this->_fk_element=$fk_element;
$this->_element=$element;
$this->_element_ref=$element_ref;
$this->_options = array(
'script_url' => $_SERVER['PHP_SELF'],
'upload_dir' => $conf->$element->dir_output . '/' . $fk_element . '/',
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$fk_element.'/',
'upload_dir' => $conf->$element->dir_output . '/' . $element_ref . '/',
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$element_ref.'/',
'param_name' => 'files',
// The php.ini settings upload_max_filesize and post_max_size
// take precedence over the following max_file_size setting:
@ -96,8 +100,8 @@ class UploadHandler
),
*/
'thumbs' => array(
'upload_dir' => $conf->$element->dir_output . '/' . $fk_element . '/thumbs/',
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$fk_element.'/thumbs/'
'upload_dir' => $conf->$element->dir_output . '/' . $element_ref . '/thumbs/',
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$element_ref.'/thumbs/'
)
)
);
@ -380,7 +384,7 @@ class UploadHandler
* View
*/
$upload_handler = new UploadHandler(null,$fk_element,$element);
$upload_handler = new UploadHandler(null,$fk_element,$element,$element_ref);
header('Pragma: no-cache');
header('Cache-Control: private, no-cache');

View File

@ -839,7 +839,7 @@ class FormFile
// Load existing files:
// TODO do not delete
if (1 == 2) {
$.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'"}, function (files) {
$.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'", element_ref: "'.$object->ref.'"}, function (files) {
var fu = $("#fileupload").data("fileupload");
fu._adjustMaxNumberOfFiles(-files.length);
fu._renderDownload(files)
@ -867,6 +867,7 @@ class FormFile
print '<form action="'.DOL_URL_ROOT.'/core/ajax/fileupload.php" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="fk_element" value="'.$object->id.'">';
print '<input type="hidden" name="element" value="'.$object->element.'">';
print '<input type="hidden" name="element_ref" value="'.$object->ref.'">';
print '<div class="fileupload-buttonbar">';
print '<input type="hidden" name="protocol" value="http">';
print '<label class="fileinput-button">';

View File

@ -172,7 +172,7 @@ if ($object->id)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id,'',0,0,$user->rights->ficheinter->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id,'',0,0,$user->rights->ficheinter->creer,50,$object);
// List of document

View File

@ -201,7 +201,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id,'',0,0,$user->rights->fournisseur->commande->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/commande/document.php?id='.$commande->id,'',0,0,$user->rights->fournisseur->commande->creer,50,$object);
// List of document

View File

@ -230,7 +230,7 @@ if ($facid > 0)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer,50,$object);
// List of document

View File

@ -171,7 +171,7 @@ if ($object->id)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/product/document.php?id='.$object->id,'',0,0,($user->rights->produit->creer||$user->rights->service->creer));
$formfile->form_attach_new_file(DOL_URL_ROOT.'/product/document.php?id='.$object->id,'',0,0,($user->rights->produit->creer||$user->rights->service->creer),50,$object);
// List of document

View File

@ -193,7 +193,7 @@ if ($id > 0 || ! empty($ref))
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/document.php?id='.$project->id,'',0,0,($userWrite>0));
$formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/document.php?id='.$project->id,'',0,0,($userWrite>0),50,$object);
// List of document

View File

@ -270,7 +270,7 @@ if ($object->id > 0)
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.($withproject?'&withproject=1':''),'',0,0,$user->rights->projet->creer);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.($withproject?'&withproject=1':''),'',0,0,$user->rights->projet->creer,50,$object);
// List of document
@ -287,4 +287,4 @@ else
llxFooter();
$db->close();
?>
?>

View File

@ -672,7 +672,10 @@ if (GETPOST("source") == 'membersubscription' && $valid)
// Debitor
$var=!$var;
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$member->getFullName($langs).'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>';
if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe;
else print $member->getFullName($langs);
print '</b>';
// Object
$var=!$var;

View File

@ -828,7 +828,10 @@ if (GETPOST("source") == 'membersubscription' && $valid)
// Debitor
$var=!$var;
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("Member");
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>'.$member->getFullName($langs).'</b>';
print '</td><td class="CTableRow'.($var?'1':'2').'"><b>';
if ($member->morphy == 'mor' && ! empty($member->societe)) print $member->societe;
else print $member->getFullName($langs);
print '</b>';
// Object
$var=!$var;

View File

@ -380,9 +380,6 @@ class Societe extends CommonObject
dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur);
// For triggers
if ($call_trigger) $this->oldobject = dol_clone($this);
$now=dol_now();
// Clean parameters

View File

@ -102,7 +102,11 @@ if (empty($reshook))
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
if ($action == 'update') $object->fetch($socid);
if ($action == 'update')
{
$ret=$object->fetch($socid);
$object->oldcopy=dol_clone($object);
}
else $object->canvas=$canvas;
if (GETPOST("private") == 1)
@ -317,8 +321,6 @@ if (empty($reshook))
exit;
}
$object->oldcopy=dol_clone($object);
// To not set code if third party is not concerned. But if it had values, we keep them.
if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client='';
if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur='';