diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 09952889c6f..7b1a56f33da 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -672,7 +672,7 @@ if ($nboftargetok) { #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; $cmd="dpkg-buildpackage -us -uc"; print "Launch DEB build ($cmd)\n"; - $ret=`$cmd`; + $ret=`$cmd 2>&1 3>&1`; print $ret."\n"; chdir("$olddir"); diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 2aad34cd229..a07395a8f4f 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -133,6 +133,8 @@ $memberstatic=new Adherent($db); $paymentstatic=new Paiement($db); $paymentsupplierstatic=new PaiementFourn($db); $paymentvatstatic=new TVA($db); +$bankstatic=new Account($db); +$banklinestatic=new AccountLine($db); $form = new Form($db); @@ -426,7 +428,8 @@ if ($id > 0 || ! empty($ref)) */ $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; - $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; + $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; + $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; if ($mode_search) { $sql.= ", s.rowid as socid, s.nom as thirdparty"; @@ -568,7 +571,34 @@ if ($id > 0 || ! empty($ref)) } else if ($links[$key]['type']=='banktransfert') { - // Do not show this link (avoid confusion). Can already be accessed from transaction detail + // Do not show link to transfer ince there is no transfer card (avoid confusion). Can already be accessed from transaction detail. + if ($objp->amount > 0) + { + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + print ' ('.$langs->trans("From "); + print $bankstatic->getNomUrl(1,'transactions'); + print ' '.$langs->trans("toward").' '; + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print $bankstatic->getNomUrl(1,''); + print ')'; + } + else + { + $bankstatic->id=$objp->bankid; + $bankstatic->label=$objp->bankref; + print ' ('.$langs->trans("From "); + print $bankstatic->getNomUrl(1,''); + print ' '.$langs->trans("toward").' '; + $banklinestatic->fetch($links[$key]['url_id']); + $bankstatic->id=$banklinestatic->fk_account; + $bankstatic->label=$banklinestatic->bank_account_label; + print $bankstatic->getNomUrl(1,'transactions'); + print ')'; + } + //var_dump($links); } else if ($links[$key]['type']=='member') { @@ -776,4 +806,4 @@ else llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 78c3c6998fd..e740ea0e387 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1081,7 +1081,7 @@ class AccountLine extends CommonObject $sql.= " b.fk_type, b.num_releve, b.num_chq, b.rappro, b.note,"; $sql.= " b.fk_bordereau, b.banque, b.emetteur,"; //$sql.= " b.author"; // Is this used ? - $sql.= " ba.label as bank_account_label"; + $sql.= " ba.ref as bank_account_ref, ba.label as bank_account_label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE b.fk_account = ba.rowid"; @@ -1122,6 +1122,7 @@ class AccountLine extends CommonObject $this->fk_bordereau = $obj->fk_bordereau; $this->fk_account = $obj->fk_account; + $this->bank_account_ref = $obj->bank_account_ref; $this->bank_account_label = $obj->bank_account_label; $ret=1; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index e2db251db1c..e7ccebbd0ee 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -944,7 +944,7 @@ class DoliDBMysqli * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resource + * @return resultset Resultset x (x->Field, x->Type, ...) */ function DDLDescTable($table,$field="") { diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 122a8e072ba..2173738f4d5 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1171,7 +1171,7 @@ class DoliDBPgsql * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resource + * @return resultset Resultset x (x->attname) */ function DDLDescTable($table,$field="") { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 96efcf9fdde..83af9f60871 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -729,12 +729,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n { $error=0; - //print "x".$file." ".$disableglob; + //print "x".$file." ".$disableglob;exit; $ok=true; $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset if (empty($disableglob) && ! empty($file_osencoded)) { - foreach (glob($file_osencoded) as $filename) + $globencoded=str_replace('[','\[',$file_osencoded); + $globencoded=str_replace(']','\]',$globencoded); + foreach (glob($globencoded) as $filename) { if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr else $ok=unlink($filename); // The unlink encapsulated by dolibarr diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 4ddc5dfcdea..90a0da8b7b3 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -66,8 +66,7 @@ class ImportCsv extends ModeleImports global $conf,$langs; $this->db = $db; - $this->separator=','; // Change also function cleansep - if (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->IMPORT_CSV_SEPARATOR_TO_USE; + $this->separator=(GETPOST('separator')?GETPOST('separator'):(empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)?',':$conf->global->IMPORT_CSV_SEPARATOR_TO_USE)); $this->enclosure='"'; $this->escape='"'; @@ -177,7 +176,7 @@ class ImportCsv extends ModeleImports */ function write_title_example($outputlangs,$headerlinefields) { - $s.=join($this->separator,array_map('cleansep',$headerlinefields)); + $s=join($this->separator,array_map('cleansep',$headerlinefields)); return $s."\n"; } @@ -582,7 +581,7 @@ class ImportCsv extends ModeleImports //var_dump($objimport->array_import_convertvalue); exit; // Build SQL request - if (! tablewithentity($tablename)) + if (! tablewithentity($tablename)) { $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key'; if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; @@ -637,12 +636,12 @@ class ImportCsv extends ModeleImports /** * Clean a string from separator * - * @param string $value Remove separator - * @return string String without separator + * @param string $value Remove standard separators + * @return string String without separators */ function cleansep($value) { - return str_replace(',','/',$value); + return str_replace(array(',',';'),'/',$value); }; /** @@ -654,25 +653,16 @@ function cleansep($value) function tablewithentity($table) { global $db; - $sql = "SHOW COLUMNS FROM ".$table." LIKE 'entity'"; - - $resql=$db->query($sql); - if ($resql) - { - $numrows=$db->num_rows($resql); - if ($numrows) - { - return 1; - } - else - { - return 0; - } - } - else - { - return -1; + + $resql=$db->DDLDescTable($table,'entity'); + if ($resql) + { + $i=0; + $obj=$db->fetch_object($resql); + if ($obj) return 1; + else return 0; } + else return -1; } -?> \ No newline at end of file +?> diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 3a469df0666..bbb17ec7dbe 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -357,8 +357,8 @@ class modSociete extends DolibarrModules $this->import_label[$r]='ImportDataset_company_2'; $this->import_icon[$r]='contact'; $this->import_entities_array[$r]=array('s.fk_soc'=>'company'); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.name'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note'=>"Note",'s.datec'=>"DateCreation"); + $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople','extra'=>MAIN_DB_PREFIX.'socpeople_extrafields'); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.lastname'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note'=>"Note",'s.datec'=>"DateCreation"); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'contact'"; $resql=$this->db->query($sql); @@ -372,7 +372,7 @@ class modSociete extends DolibarrModules } } // End add extra fields - $this->import_fieldshidden_array[$r]=array('s.fk_user_creat'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_fieldshidden_array[$r]=array('s.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'socpeople'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r]=array( 's.fk_soc'=>array('rule'=>'fetchidfromref','file'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty'), 's.fk_pays'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cpays.class.php','class'=>'Cpays','method'=>'fetch','dict'=>'DictionnaryCountry'), diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 1ca0b29708c..451b85f81e8 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -54,7 +54,7 @@ else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();} else size.val('').attr('disabled','disabled'); } - init_typeoffields(''); + init_typeoffields(''); jQuery("#type").change(function() { init_typeoffields($(this).val()); }); diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index e7d599f8d68..65ec397e242 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1017,7 +1017,7 @@ if ($step == 4 && $datatoimport) } else { - print ''.$langs->trans("NextStep").''; + print ''.$langs->trans("NextStep").''; } } @@ -1281,7 +1281,7 @@ if ($step == 5 && $datatoimport) } else { - print ''.$langs->trans("RunSimulateImportFile").''; + print ''.$langs->trans("RunSimulateImportFile").''; } print ''; } diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 858e096aa36..54ed69216ac 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -326,7 +326,7 @@ class FilesLibTest extends PHPUnit_Framework_TestCase // Again to test with overwriting=1 $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1); print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(1,$result,'copy destination already eists, overwrite'); // Should be 1 + $this->assertGreaterThanOrEqual(1,$result,'copy destination already exists, overwrite'); // Should be 1 // Again to test with overwriting=1 $result=dol_move($conf->admin->dir_temp.'/file.csv',$conf->admin->dir_temp.'/file2.csv',0,1); @@ -341,6 +341,16 @@ class FilesLibTest extends PHPUnit_Framework_TestCase $result=dol_delete_file($conf->admin->dir_temp.'/file2.csv'); print __METHOD__." result=".$result."\n"; $this->assertTrue($result,'delete file that does not exists'); + + // Test copy with special char / delete with blob + $result=dol_copy($file, $conf->admin->dir_temp.'/file with [x] and é.csv',0,1); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThanOrEqual(1,$result,'copy file with special chars, overwrite'); // Should be 1 + + // Try to delete using a glob criteria + $result=dol_delete_file($conf->admin->dir_temp.'/file with [x]*é.csv'); + print __METHOD__." result=".$result."\n"; + $this->assertTrue($result,'delete file using glob'); } /**