Work on generic usage of get_exdir.

This commit is contained in:
Laurent Destailleur
2015-05-18 23:04:49 +02:00
parent 15c355efc9
commit 4a70bb7acf
9 changed files with 40 additions and 29 deletions

View File

@@ -3713,13 +3713,16 @@ function yn($yesno, $case=1, $color=0)
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')
* @return string Dir to use ending. Example '' or '1/' or '1/2/'
*/
function get_exdir($num,$level,$alpha=0,$withoutslash=0,$object=null,$modulepart='')
function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
{
global $conf;
$path = '';
if (! empty($level) && in_array($modulepart, array('shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
// TODO if object is null, load it from id and modulepart.
if (! empty($level) && in_array($modulepart, array('cheque','user','category','shipment', 'member','don','donation','supplier_invoice','invoice_supplier')))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);