diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 04bae53a6b0..80182c61adb 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -295,14 +295,14 @@ if ($id > 0 || ! empty($ref)) */ $param.='&account='.$object->id.'&vline='.$vline; - // Confirmation delete - if ($action == 'delete') - { - $text=$langs->trans('ConfirmDeleteTransaction'); - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete'); - if ($ret == 'html') print '
'; - } - + // Confirmation delete + if ($action == 'delete') + { + $text=$langs->trans('ConfirmDeleteTransaction'); + $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete'); + if ($ret == 'html') print '
'; + } + // Define transaction list navigation string print '
'; print ''; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d6d135edc4a..61d247ff2c2 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1553,4 +1553,31 @@ function pdf_getLinkedObjects($object,$outputlangs) return $linkedobjects; } +/** + * Return dimensions to use for images onto PDF + * + * @param string $realpath Full path to photo file to use + * @return array Height/Width to use to output image (in pixel) + */ +function pdf_getHeightForImage($realpath) +{ + $maxheight=12; $maxwidth=16; + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + $tmp=dol_getImageSize($realpath); + if ($tmp['height']) + { + $width=(int) round($maxheight*$tmp['width']/$tmp['height']); + if ($width > $maxwidth) + { + $height=(int) round($height*$maxwidth/$width); + $width=$maxwidth; + } + else + { + $height=$maxheight; + } + } + return array('width'=>$width,'height'=>$height); +} + ?> diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index d0295a33f72..caeb4c3be1d 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -282,15 +282,15 @@ class pdf_azur extends ModelePDFPropales $showpricebeforepagebreak=1; $pdf->startTransaction(); - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) - { + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) + { pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); - } - else - { - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); } - + else + { + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); + } + $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -298,13 +298,13 @@ class pdf_azur extends ModelePDFPropales $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) - { - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); - } - else - { - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) + { + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); + } + else + { + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); } $pageposafter=$pdf->getPage(); @@ -343,53 +343,60 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - // Photo - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) - { - $curX = $this->posxpicture-1; - if ($object->lines[$i]->fk_product) - { - $objphoto = new Product($this->db); - $objphoto->fetch($object->lines[$i]->fk_product); - - $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/"; - $dir = $conf->product->dir_output.'/'.$pdir; - + // Photo + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) + { + $curX = $this->posxpicture-1; + if ($object->lines[$i]->fk_product) + { + $objphoto = new Product($this->db); + $objphoto->fetch($object->lines[$i]->fk_product); + + $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + $realpath=''; if ($object->ref == 'SPECIMEN') { $realpath = DOL_DOCUMENT_ROOT.'/theme/common/nophoto.jpg'; } else - { - foreach ($objphoto->liste_photos($dir,1) as $key => $obj) - { - if ($obj['photo_vignette']) - { - $filename='thumbs/'.$obj['photo_vignette']; - } - else - { - $filename=$obj['photo']; - } - + { + foreach ($objphoto->liste_photos($dir,1) as $key => $obj) + { + if ($obj['photo_vignette']) + { + $filename='thumbs/'.$obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + $realpath = $dir.$filename; - break; - } + break; + } } - - if (!empty($realpath)) - { + + if (!empty($realpath)) + { + //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $tmp=pdf_getHeightForImage($realpath); - //var_dump($tmp['height']);exit; - $pdf->Image($realpath, $curX, $curY-1, $tmp['width'], $tmp['height'],'','','',2, 300); // Use 300 dpi + //var_dump(constant('PDF_IMAGE_SCALE_RATIO'));var_dump($pdf->getImageScale());var_dump($tmp['width']);var_dump($pdf->pixelsToUnits($tmp['width']));exit; + // measures 1/72 of an inch, i.e. approximately 0.0139 inch or 25.4/72 = 0.3528 mm + var_dump($this->page_largeur);exit; + //var_dump(tmp['height']);exit; + $pdf->Line($this->posxtva,10,$this->posxtva+0.5,10); + $pdf->Image($realpath, $this->posxtva, 10, $tmp['width'], $tmp['height'],'','','',2,0); // Use 300 dpi + $pdf->Line($this->posxtva+$pdf->pixelsToUnits($tmp['width']),10,$this->posxtva+$pdf->pixelsToUnits($tmp['width'])+0.5,10); + $pdf->Image($realpath, $curX + ($this->posxtva-$this->posxpicture-($pdf->pixelsToUnits($tmp['width'])))/2, $curY-1, $tmp['width'], $tmp['height'],'','','',2, 300); // Use 300 dpi //$nexY += 7; // +7 for height = 12 - $nexY += round($tmp['height'] / 12 * 7); - //var_dump($nexY);exit; + $nexY += round($pdf->pixelsToUnits($tmp['height'])); + //var_dump($nexY);exit; } - } - } - + } + } + // VAT Rate if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { @@ -1073,15 +1080,15 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) - { - $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); - if (empty($hidetop)) - { - $pdf->SetXY($this->posxpicture-1, $tab_top+1); - $pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C'); - } - } + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE)) + { + $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxpicture-1, $tab_top+1); + $pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C'); + } + } if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 6478f420931..6da877e6018 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -60,7 +60,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); if (! isset($argv[3]) || ! $argv[3]) { print "Usage: ".$script_file." bank_ref [bank_receipt_number|all] (csv|tsv|excel|excel2007) [lang=xx_XX]\n"; @@ -177,7 +177,7 @@ $array_export_TypeFields=array( $listofnum=""; if (! empty($num) && $num != "all") { - $listofnum.="'"; + $listofnum.="'"; $arraynum=explode(',',$num); foreach($arraynum as $val) { diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 63c0018baf9..55c1b04b400 100644 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -60,7 +60,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); $fname = DOL_DATA_ROOT.'/export-contacts.xls'; diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index d751808ba0f..d4e6f9e7ca5 100644 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -57,7 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); print "Mails sending disabled (useless in batch mode)\n"; $conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 13734eeb8b7..9753599115c 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -66,7 +66,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[2])?$argv[2]:'none'; diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 810d019b016..a41a59de3cf 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -66,7 +66,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[2])?$argv[2]:'none'; diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 0e73a713089..fbd7bf7b466 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -67,7 +67,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[3])?$argv[3]:'none'; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 7038c7297dc..e3b23a932d5 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -66,7 +66,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[2])?$argv[2]:'none'; diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index ba47d0be063..2bba8666e0c 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -57,7 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); // Check parameters if (! isset($argv[1])) diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php index e2095327e1f..840cf464ba2 100755 --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -52,7 +52,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); if (! isset($argv[1]) || ! $argv[1]) { print "Usage: $script_file now\n"; diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 69e72f0e3d7..83dfd196ae0 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -57,7 +57,7 @@ $forcecommit=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); // List of fields to get from LDAP $required_fields = array( diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index c16f822a04f..c6793212032 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -55,7 +55,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); /* if (! $conf->global->LDAP_SYNCHRO_ACTIVE) diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 38051c25fd4..485f0dbf72a 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -57,7 +57,7 @@ $forcecommit=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); // List of fields to get from LDAP $required_fields = array( diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index 1f89d9de43f..9fcd3bc40dc 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -55,7 +55,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); /* if (! $conf->global->LDAP_SYNCHRO_ACTIVE) diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index a73496538fc..8e831e26e84 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -55,7 +55,7 @@ $forcecommit=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); // List of fields to get from LDAP $required_fields = array( diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index 1ae37abaf59..a842aeb1f1b 100644 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -51,7 +51,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; -dol_syslog($script_file." launched with arg ".join(',',$argv)); +dol_syslog($script_file." launched with arg ".join(',',$argv)); $datetimeprev = dol_now();