Pārlūkot izejas kodu

Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0

Conflicts:
	htdocs/comm/propal/card.php
	htdocs/societe/class/societe.class.php
Laurent Destailleur 2 gadi atpakaļ
vecāks
revīzija
bc2e226ef8

+ 15 - 6
htdocs/accountancy/class/accountancyexport.class.php

@@ -696,9 +696,12 @@ class AccountancyExport
 
 	/**
 	 * Export format : WinFic - eWinfic - WinSis Compta
+	 * Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr)
 	 *
+	 * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf
 	 *
 	 * @param array $TData data
+	 *
 	 * @return void
 	 */
 	public function exportWinfic(&$TData)
@@ -706,10 +709,14 @@ class AccountancyExport
 		global $conf;
 
 		$end_line = "\r\n";
+		$index = 1;
 
 		//We should use dol_now function not time however this is wrong date to transfert in accounting
 		//$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
 		//$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
+
+		// Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted
+
 		foreach ($TData as $data) {
 			$code_compta = $data->numero_compte;
 			if (!empty($data->subledger_account)) {
@@ -718,7 +725,7 @@ class AccountancyExport
 
 			$Tab = array();
 			//$Tab['type_ligne'] = 'M';
-			$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
+			$Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2, 'right', 'UTF-8', 1), 2);
 
 			//We use invoice date $data->doc_date not $date_ecriture which is the transfert date
 			//maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ?
@@ -727,11 +734,11 @@ class AccountancyExport
 
 			$Tab['folio'] = '     1';
 
-			$Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT);
+			$Tab['num_ecriture'] = str_pad(dol_trunc($index, 6, 'right', 'UTF-8', 1), 6, ' ', STR_PAD_LEFT);
 
 			$Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
 
-			$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
+			$Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6, 'right', 'UTF-8', 1), 6, '0');
 
 			if ($data->sens == 'D') {
 				$Tab['montant_debit']  = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
@@ -743,11 +750,11 @@ class AccountancyExport
 				$Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
 			}
 
-			$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30);
+			$Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30);
 
-			$Tab['lettrage'] = str_repeat(' ', 2);
+			$Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2);
 
-			$Tab['code_piece'] = str_repeat(' ', 5);
+			$Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5, 'left', 'UTF-8', 1), 5, ' ', STR_PAD_LEFT);
 
 			$Tab['code_stat'] = str_repeat(' ', 4);
 
@@ -771,6 +778,8 @@ class AccountancyExport
 			$Tab['end_line'] = $end_line;
 
 			print implode('|', $Tab);
+
+			$index++;
 		}
 	}
 

+ 2 - 2
htdocs/comm/propal/card.php

@@ -1731,13 +1731,13 @@ if ($action == 'create') {
 	// Terms of payment
 	print '<tr class="field_cond_reglement_id"><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
 	print img_picto('', 'paiment');
-	$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
+	$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
 	print '</td></tr>';
 
 	// Mode of payment
 	print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
 	print img_picto('', 'bank', 'class="pictofixedwidth"');
-	$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
+	$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
 	print '</td></tr>';
 
 	// Bank Account

+ 2 - 2
htdocs/core/class/commonobject.class.php

@@ -2176,7 +2176,7 @@ abstract class CommonObject
 					$sql .= " AND te.entity IS NOT NULL"; // Show all users
 				} else {
 					$sql .= " AND ug.fk_user = te.rowid";
-					$sql .= " AND ug.entity IN (".getEntity($this->element).")";
+					$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
 				}
 			} else {
 				$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
@@ -2246,7 +2246,7 @@ abstract class CommonObject
 					$sql .= " AND te.entity IS NOT NULL"; // Show all users
 				} else {
 					$sql .= " AND ug.fk_user = te.rowid";
-					$sql .= " AND ug.entity IN (".getEntity($this->element).")";
+					$sql .= " AND ug.entity IN (".getEntity('usergroup').")";
 				}
 			} else {
 				$sql .= ' AND te.entity IN ('.getEntity($this->element).')';

+ 3 - 3
htdocs/install/step5.php

@@ -222,9 +222,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
 				print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
 				$success = 1;
 			} else {
-				if ($newuser->error == 'ErrorLoginAlreadyExists') {
+				if ($result == -6) {	//login or email already exists
 					dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
-					print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists", $login)."</div><br>";
+					print '<br><div class="warning">'.$newuser->error."</div><br>";
 					$success = 1;
 				} else {
 					dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
@@ -450,7 +450,7 @@ if ($action == "set") {
 		$morehtml .= '</a></div>';
 	}
 } else {
-	dol_print_error('', 'step5.php: unknown choice of action');
+	dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
 }
 
 // Clear cache files

+ 1 - 1
htdocs/user/class/user.class.php

@@ -3781,7 +3781,7 @@ class User extends CommonObject
 				} else {
 					$sql .= ",".$this->db->prefix()."usergroup_user as ug";
 					$sql .= " WHERE ((ug.fk_user = t.rowid";
-					$sql .= " AND ug.entity IN (".getEntity('user')."))";
+					$sql .= " AND ug.entity IN (".getEntity('usergroup')."))";
 					$sql .= " OR t.entity = 0)"; // Show always superadmin
 				}
 			} else {