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

This commit is contained in:
Laurent Destailleur 2021-07-08 17:24:39 +02:00
commit ec09d95dc6
2 changed files with 77 additions and 1 deletions

View File

@ -59,6 +59,8 @@ class AccountancyExport
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_GESTIMUMV3 = 130;
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
public static $EXPORT_TYPE_ISUITEEXPERT = 200;
// Generic FEC after that
public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010;
@ -123,6 +125,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
);
ksort($listofexporttypes, SORT_NUMERIC);
@ -158,6 +161,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2',
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
);
return $formatcode[$type];
@ -243,6 +247,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_FEC2'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_ISUITEEXPERT => array(
'label' => 'iSuite Expert',
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
),
),
'cr'=> array(
'1' => $langs->trans("Unix"),
@ -334,6 +342,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_FEC2:
$this->exportFEC2($TData);
break;
case self::$EXPORT_TYPE_ISUITEEXPERT :
$this->exportiSuiteExpert($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@ -1752,6 +1763,62 @@ class AccountancyExport
}
}
/**
* Export format : iSuite Expert
*
* by OpenSolus [https://opensolus.fr]
*
* @param array $objectLines data
*
* @return void
*/
public function exportiSuiteExpert($objectLines)
{
$this->separator = ';';
$this->end_line = "\r\n";
foreach ($objectLines as $line) {
$tab = array();
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
$tab[] = $line->piece_num;
$tab[] = $date;
$tab[] = substr($date, 6, 4);
$tab[] = substr($date, 3, 2);
$tab[] = substr($date, 0, 2);
$tab[] = $line->doc_ref;
//Conversion de chaine UTF8 en Latin9
$tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire', '', $line->label_operation), "Windows-1252", 'UTF-8');
//Calcul de la longueur des numéros de comptes
$taille_numero = strlen(length_accountg($line->numero_compte));
//Création du numéro de client générique
$numero_cpt_client = '411';
for ($i = 1; $i <= ($taille_numero - 3); $i++) {
$numero_cpt_client .= '0';
}
//Création des comptes auxiliaire des clients
if (length_accountg($line->numero_compte) == $numero_cpt_client) {
$tab[] = rtrim(length_accounta($line->subledger_account), "0");
} else {
$tab[] = length_accountg($line->numero_compte);
}
$nom_client = explode(" - ", $line->label_operation);
$tab[] = mb_convert_encoding($nom_client[0], "Windows-1252", 'UTF-8');
$tab[] = price($line->debit);
$tab[] = price($line->credit);
$tab[] = price($line->montant);
$tab[] = $line->code_journal;
$separator = $this->separator;
print implode($separator, $tab) . $this->end_line;
}
}
/**
* trunc
*

View File

@ -494,7 +494,7 @@ if ($search_billed != '' && $search_billed >= 0) {
$sql .= ' AND c.facture = '.((int) $search_billed);
}
if ($search_status <> '') {
if ($search_status < 4 && $search_status > -3) {
if ($search_status < 4 && $search_status > -4) {
if ($search_status == 1 && empty($conf->expedition->enabled)) {
$sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated'
} else {
@ -513,6 +513,11 @@ if ($search_status <> '') {
//$sql.= ' AND c.facture = 0'; // invoice not created
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
}
if ($search_status == -4) { // "validate and in progress"
$sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process
}
}
if ($search_datecloture_start) {
@ -675,6 +680,9 @@ if ($resql) {
if ($search_status == -3) {
$title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
}
if ($search_status == -4) {
$title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort");
}
$num = $db->num_rows($resql);
@ -1236,6 +1244,7 @@ if ($resql) {
Commande::STATUS_SHIPMENTONPROCESS=>$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
-4=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"),
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
);
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);