Merge pull request #12183 from frederic34/longlines

cut long lines
This commit is contained in:
Laurent Destailleur 2019-10-20 13:29:01 +02:00 committed by GitHub
commit 1faea24eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 109 additions and 44 deletions

View File

@ -294,7 +294,18 @@ if ($result && $action == "dl" && ! $error)
dol_mkdir($dirfortmpfile); dol_mkdir($dirfortmpfile);
$log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n"; $log = $langs->transnoentitiesnoconv("Type");
$log .= ',' . $langs->transnoentitiesnoconv("Date");
$log .= ',' . $langs->transnoentitiesnoconv("Ref");
$log .= ',' . $langs->transnoentitiesnoconv("TotalHT");
$log .= ',' . $langs->transnoentitiesnoconv("TotalTTC");
$log .= ',' . $langs->transnoentitiesnoconv("TotalVAT");
$log .= ',' . $langs->transnoentitiesnoconv("Paid");
$log .= ',filename,item_id';
$log .= ',' . $langs->transnoentitiesnoconv("ThirdParty");
$log .= ',' . $langs->transnoentitiesnoconv("Code");
$log .= ',' . $langs->transnoentitiesnoconv("Country");
$log .= ',' . $langs->transnoentitiesnoconv("VATIntra")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
dol_delete_file($zipname); dol_delete_file($zipname);
@ -305,8 +316,20 @@ if ($result && $action == "dl" && ! $error)
{ {
foreach ($filesarray as $key => $file) foreach ($filesarray as $key => $file)
{ {
if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]);
$log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n"; $log .= $file['item'];
$log .= ',' . dol_print_date($file['date'], 'dayrfc');
$log .= ',' . $file['ref'];
$log .= ',' . $file['amount_ht'];
$log .= ',' . $file['amount_ttc'];
$log .= ',' . $file['amount_vat'];
$log .= ',' . $file['paid'];
$log .= ',' . $file["name"];
$log .= ',' . $file['fk'];
$log .= ',' . $file['thirdparty_name'];
$log .= ',' . $file['thirdparty_code'];
$log .= ',' . $file['country_code'];
$log .= ',"' . $file['vatnum'].'"'."\n";
} }
$zip->addFromString('transactions.csv', $log); $zip->addFromString('transactions.csv', $log);
$zip->close(); $zip->close();

View File

@ -2702,45 +2702,74 @@ class Facture extends CommonInvoice
/** /**
* Add an invoice line into database (linked to product/service or not). * Add an invoice line into database (linked to product/service or not).
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
* *
* @param string $desc Description of line * @param string $desc Description of line
* @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity * @param double $qty Quantity
* @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) * @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) * @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id of predefined product/service * @param int $fk_product Id of predefined product/service
* @param double $remise_percent Percent of discount on line * @param double $remise_percent Percent of discount on line
* @param int $date_start Date start of service * @param int $date_start Date start of service
* @param int $date_end Date end of service * @param int $date_end Date end of service
* @param int $ventil Code of dispatching into accountancy * @param int $ventil Code of dispatching into accountancy
* @param int $info_bits Bits of type of lines * @param int $info_bits Bits of type of lines
* @param int $fk_remise_except Id discount used * @param int $fk_remise_except Id discount used
* @param string $price_base_type 'HT' or 'TTC' * @param string $price_base_type 'HT' or 'TTC'
* @param double $pu_ttc Unit price with tax (> 0 even for credit note) * @param double $pu_ttc Unit price with tax (> 0 even for credit note)
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
* @param int $rang Position of line * @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!) * @param int $special_code Special code (also used by externals modules!)
* @param string $origin 'order', ... * @param string $origin 'order', ...
* @param int $origin_id Id of origin object * @param int $origin_id Id of origin object
* @param int $fk_parent_line Id of parent line * @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Supplier price id (to calculate margin) or '' * @param int $fk_fournprice Supplier price id (to calculate margin) or ''
* @param int $pa_ht Buying price of line (to calculate margin) or '' * @param int $pa_ht Buying price of line (to calculate margin) or ''
* @param string $label Label of the line (deprecated, do not use) * @param string $label Label of the line (deprecated, do not use)
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @param int $situation_percent Situation advance percentage * @param int $situation_percent Situation advance percentage
* @param int $fk_prev_id Previous situation line id reference * @param int $fk_prev_id Previous situation line id reference
* @param string $fk_unit Code of the unit to use. Null to use the default one * @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency * @param double $pu_ht_devise Unit price in currency
* @return int <0 if KO, Id of line if OK * @return int <0 if KO, Id of line if OK
*/ */
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) public function addline(
{ $desc,
$pu_ht,
$qty,
$txtva,
$txlocaltax1 = 0,
$txlocaltax2 = 0,
$fk_product = 0,
$remise_percent = 0,
$date_start = '',
$date_end = '',
$ventil = 0,
$info_bits = 0,
$fk_remise_except = '',
$price_base_type = 'HT',
$pu_ttc = 0,
$type = self::TYPE_STANDARD,
$rang = -1,
$special_code = 0,
$origin = '',
$origin_id = 0,
$fk_parent_line = 0,
$fk_fournprice = null,
$pa_ht = 0,
$label = '',
$array_options = 0,
$situation_percent = 100,
$fk_prev_id = 0,
$fk_unit = null,
$pu_ht_devise = 0
) {
// Deprecation warning // Deprecation warning
if ($label) { if ($label) {
dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING);

View File

@ -561,8 +561,15 @@ if ($num > 0)
} }
if ($user->rights->cron->execute) if ($user->rights->cron->execute)
{ {
if (!empty($obj->status)) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute'.(empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").'</a>'; if (!empty($obj->status)) {
else print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'), "playdisabled").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=execute';
print (empty($conf->global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY);
print ($sortfield?'&sortfield='.$sortfield:'');
print ($sortorder?'&sortorder='.$sortorder:'');
print $param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").'</a>';
} else {
print '<a href="#" class="cursordefault" title="'.dol_escape_htmltag($langs->trans('JobDisabled')).'">'.img_picto($langs->trans('JobDisabled'), "playdisabled").'</a>';
}
} else { } else {
print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled").'</a>'; print '<a href="#" class="cursornotallowed" title="'.dol_escape_htmltag($langs->trans('NotEnoughPermissions')).'">'.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled").'</a>';
} }

View File

@ -85,8 +85,14 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
{ {
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); $arrayfields["ef.".$key] = array(
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1),
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])
);
}
} }
} }
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');