Merge branch 'trunk'
This commit is contained in:
commit
7aacf3ba2e
5 changed files with 75 additions and 15 deletions
|
|
@ -115,6 +115,7 @@ class Coupon extends Model
|
|||
'coupon_validity_text',
|
||||
'coupon_site_contact',
|
||||
'coupon_legal_mentions',
|
||||
'coupon_legal_mentions_splitted',
|
||||
'coupon_seuil_alert',
|
||||
'coupon_treatment_center'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -129,7 +129,11 @@ class CouponController extends Controller
|
|||
} else {
|
||||
$coupon->coupon_published = 0;
|
||||
}
|
||||
|
||||
if (isset($datas['coupon_legal_mentions_splitted'])) {
|
||||
$coupon->coupon_legal_mentions_splitted = $datas['coupon_legal_mentions_splitted'];
|
||||
} else {
|
||||
$coupon->coupon_legal_mentions_splitted = 0;
|
||||
}
|
||||
$coupon->coupon_validity = $datas['coupon_validity'];
|
||||
$coupon->coupon_mindatediffusion = $datas['coupon_mindatediffusion'];
|
||||
$coupon->coupon_maxdatediffusion = $datas['coupon_maxdatediffusion'];
|
||||
|
|
@ -246,6 +250,9 @@ class CouponController extends Controller
|
|||
if(!isset($request->coupon_published)){
|
||||
$coupon->coupon_published = 0;
|
||||
}
|
||||
if(!isset($request->coupon_legal_mentions_splitted)){
|
||||
$coupon->coupon_legal_mentions_splitted = 0;
|
||||
}
|
||||
if ($coupon->update($this->saveImg($request))) {
|
||||
$datas = $this->saveImg($request);
|
||||
$br_path = $this->generateBase($request, $coupon);
|
||||
|
|
|
|||
|
|
@ -53,22 +53,23 @@ trait GenerateBR {
|
|||
|
||||
|
||||
// ----- Mentions légales + RCS
|
||||
$txt_mentions = $coupon->coupon_legal_mentions." ".$coupon->coupon_rcs;
|
||||
$ImageMentionFond = imagecreate(415, 100);
|
||||
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
|
||||
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
|
||||
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
|
||||
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
|
||||
$lines_mentions = explode("\r\n", $txt_mentions);
|
||||
$y = 19;
|
||||
foreach ($lines_mentions as $line) {
|
||||
if($coupon->coupon_legal_mentions_splitted == 0){
|
||||
$txt_mentions = $coupon->coupon_legal_mentions." ".$coupon->coupon_rcs;
|
||||
$ImageMentionFond = imagecreate(415, 100);
|
||||
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
|
||||
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
|
||||
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
|
||||
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
|
||||
$lines_mentions = explode("\r\n", $txt_mentions);
|
||||
$y = 19;
|
||||
foreach ($lines_mentions as $line) {
|
||||
$this->imagettftextSp($ImageMentionFond , 7 , 0, 15, $y, $black, $arial, $line, 0.01);
|
||||
$y = $y +9;
|
||||
}
|
||||
|
||||
$this->imagettftextSp($ImageMentionFond , 7 , 0, 15, $y, $black, $arial, $line, 0.01);
|
||||
$y = $y +9;
|
||||
//imagecolortransparent($ImageMentionFond, $white);
|
||||
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
|
||||
}
|
||||
|
||||
//imagecolortransparent($ImageMentionFond, $white);
|
||||
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
|
||||
|
||||
// ---- Copie la main dans le mask
|
||||
$hand = imagecreatefrompng($hand_picture);
|
||||
|
|
@ -254,6 +255,47 @@ trait GenerateBR {
|
|||
|
||||
list($maskWidth, $maskHeight) = getimagesize($coupon->coupon_image);
|
||||
|
||||
|
||||
// ----- Mentions légales + RCS dépendant de l'user
|
||||
if ($coupon->coupon_legal_mentions_splitted == 1) {
|
||||
$legalMentions = explode('<nl>', $coupon->coupon_legal_mentions);
|
||||
if($coupon->coupon_norme == 1 && strlen($contact->contact_cp)==4){
|
||||
//BELGE
|
||||
$txt_mentions = $legalMentions[0]."\n\r".$legalMentions[1]." ".$coupon->coupon_rcs;
|
||||
$ImageMentionFond = imagecreate(420, 145);
|
||||
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
|
||||
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
|
||||
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
|
||||
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
|
||||
$lines_mentions = explode("\r\n", $txt_mentions);
|
||||
$y = 19;
|
||||
foreach ($lines_mentions as $line) {
|
||||
$this->imagettftextSp($ImageMentionFond , 7 , 0, 15, $y, $black, $arial, $line, 0.01);
|
||||
$y = $y +9;
|
||||
}
|
||||
//imagecolortransparent($ImageMentionFond, $white);
|
||||
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
|
||||
} else {
|
||||
//FR
|
||||
$txt_mentions = $legalMentions[0]." ".$coupon->coupon_rcs;
|
||||
$ImageMentionFond = imagecreate(415, 100);
|
||||
$boxMentions = imagettfbbox(7, 0, $arial, $txt_mentions);
|
||||
$white = imagecolorallocate($ImageMentionFond, 255, 255, 255);
|
||||
imagefilledrectangle($ImageMentionFond, 0, 0, 414, 99, $white);
|
||||
$black = imagecolorallocate($ImageMentionFond, 0, 0, 0);
|
||||
$lines_mentions = explode("\r\n", $txt_mentions);
|
||||
$y = 19;
|
||||
foreach ($lines_mentions as $line) {
|
||||
|
||||
$this->imagettftextSp($ImageMentionFond , 7 , 0, 15, $y, $black, $arial, $line, 0.01);
|
||||
$y = $y +9;
|
||||
}
|
||||
//imagecolortransparent($ImageMentionFond, $white);
|
||||
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---- Inscription de l'utilisateur et de la ville
|
||||
$libelle = "OFFRE RÉSERVÉE À";
|
||||
$user = $contact->contact_prenom." ".$contact->contact_nom."\r\n".$contact->contact_cp. " ".$contact->contact_ville;
|
||||
|
|
|
|||
|
|
@ -127,6 +127,11 @@
|
|||
{!! Form::label('coupon_treatment_center', 'Centre de traitement *') !!}
|
||||
{!! Form::select('coupon_treatment_center', ['HighCo', 'Sogec']) !!}
|
||||
</div>
|
||||
<div class="form-field">
|
||||
{!! Form::label('coupon_legal_mentions_splitted', 'Activer les mentions internationnales') !!}
|
||||
{!! Form::checkbox('coupon_legal_mentions_splitted', 1, false) !!}
|
||||
{!! Form::label('coupon_legal_mentions_splitted', 'Activer') !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-split">
|
||||
<div class="form-field-textarea">
|
||||
|
|
|
|||
|
|
@ -177,6 +177,11 @@
|
|||
{!! Form::label('coupon_treatment_center', 'Centre de traitement *') !!}
|
||||
{!! Form::select('coupon_treatment_center', ['HighCo', 'Sogec']) !!}
|
||||
</div>
|
||||
<div class="form-field">
|
||||
{!! Form::label('coupon_legal_mentions_splitted', 'Activer les mentions internationnales') !!}
|
||||
{!! Form::checkbox('coupon_legal_mentions_splitted', 1, ($coupon->coupon_legal_mentions_splitted ==1?true:null)) !!}
|
||||
{!! Form::label('coupon_legal_mentions_splitted', 'Activer') !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-split">
|
||||
<div class="form-field-textarea">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue