From fb186d6ef8a403b49a0bdefccc68ee1c27534180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 18 Jan 2015 16:26:26 +0100 Subject: [PATCH 1/9] Added delay between mails in Newsletter module --- ChangeLog | 1 + htdocs/admin/mailing.php | 9 +++++++++ htdocs/comm/mailing/card.php | 5 ++++- htdocs/langs/en_US/admin.lang | 1 + scripts/emailings/mailing-send.php | 5 +++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6691ddb2007..06f01bc0e11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ For users: MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price. - Introduce option MAIN_HTML_TITLE to start to control format of html title content. - Add extrafields on bank account cards. +- Added delay between mails in Newsletter module For translators: - Update language files. diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 22a6531fad6..8c080999e6c 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -48,11 +48,14 @@ if ($action == 'setvalue') $mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha'); $checkread = GETPOST('value','alpha'); $checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY','alpha'); + $mailingdelay = GETPOST('MAILING_DELAY', 'int'); $res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; $res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; + $res=dolibarr_set_const($db, "MAILING_DELAY",$mailingdelay,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; // Create temporary encryption key if nedded $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity); @@ -124,6 +127,12 @@ print ''; +$var=!$var; +print ''; +print $langs->trans("MailingDelay").''; +print ''; +print ''; + // Constant to add salt into the unsubscribe and check read tag. // It is also used as a security key parameter. $var=!$var; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index ca4c27bfdbc..821fadb94c9 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -323,7 +323,10 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes') } } - + if (!empty($conf->global->MAILING_DELAY)) { + sleep($conf->global->MAILING_DELAY); + } + //test if CHECK READ change statut prospect contact } else diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0b328e705a7..03180d37b69 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1393,6 +1393,7 @@ RSSUrlExample=An interesting RSS feed MailingSetup=EMailing module setup MailingEMailFrom=Sender EMail (From) for emails sent by emailing module MailingEMailError=Return EMail (Errors-to) for emails with errors +MailingDelay=Seconds to wait after sending next message ##### Notification ##### NotificationSetup=EMail notification module setup NotificationEMailFrom=Sender EMail (From) for emails sent for notifications diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 1de66b491ed..e7b32b2d3bc 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -245,6 +245,11 @@ if ($resql) $error++; } } + + if (!empty($conf->global->MAILING_DELAY)) { + sleep($conf->global->MAILING_DELAY); + } + } } else From 388697b73eeae0ee4685eddc83ff98c25cd58240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 18:55:55 +0100 Subject: [PATCH 2/9] Use getNomUrl on every list to uniformize display --- htdocs/comm/card.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a775408e9a8..42478175dfa 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -531,11 +531,13 @@ if ($id > 0) $objp = $db->fetch_object($resql); $var=!$var; print ""; - print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; - if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) - { - print " ".img_warning(); - } + print ''; + $propal_static->id=$objp->propalid; + $propal_static->ref=$objp->ref; + print $propal_static->getNomUrl(1); + if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { + print " ".img_warning(); + } print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; print ''.price($objp->total_ht).''; print ''.$propal_static->LibStatut($objp->fk_statut,5).''; @@ -606,7 +608,10 @@ if ($id > 0) $objp = $db->fetch_object($resql); $var=!$var; print ""; - print ''.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."\n"; + print ''; + $commande_static->id=$objp->cid; + $commande_static->ref=$objp->ref; + print $commande_static->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dc),'day')."\n"; print ''.price($objp->total_ht).''; print ''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).''; From e82301e001a3014204a7f32e798bfb29428dcd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 19:07:34 +0100 Subject: [PATCH 3/9] Update card.php --- htdocs/fourn/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 205d1a89ea6..154800125bf 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -367,7 +367,11 @@ if ($object->id > 0) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref.''; + print ''; + $orderstatic->id=$obj->rowid; + $orderstatic->ref=$obj->ref; + print $orderstatic->getNomUrl(1); + print ''; print ''; if ($obj->dc) { From 1fc9517200ad6f69414478ff05ba6df967deeae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 19:18:57 +0100 Subject: [PATCH 4/9] Use css badge --- htdocs/fourn/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 205d1a89ea6..192bdff9abb 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -299,7 +299,7 @@ if ($object->id > 0) print ''; print ''; print '
'.$langs->trans("ProductsAndServices").''; - print ''.$langs->trans("All").' ('.$object->nbOfProductRefs().')'; + print ''.$langs->trans("All").' '.$object->nbOfProductRefs().''; print '
'; } @@ -355,7 +355,7 @@ if ($object->id > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("LastOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; @@ -422,7 +422,7 @@ if ($object->id > 0) print ''; print ''; - print ''; + print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' ('.$num.')
'; print ''; print '
'.$langs->trans('LastSuppliersBills',($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; From 2d911e1a8f2897e1e34900458616b772b7dd41f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:19:36 +0100 Subject: [PATCH 5/9] Update card.php --- htdocs/comm/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a775408e9a8..b0ae3beef6b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -519,7 +519,7 @@ if ($id > 0) print ''; print ''; - print '
'; + print ''; print ''; @@ -592,7 +592,7 @@ if ($id > 0) print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')'; print ''; print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - print '
'; + print ''; print ''; } $i = 0; @@ -706,7 +706,7 @@ if ($id > 0) print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'; print ''; //if($num2 > 0) print ''; //else print ''; @@ -647,7 +647,7 @@ if ($id > 0) print ''; print ''; + print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; - print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' ('.$num.')
'.$langs->trans("AllContracts").' '.$num.'
'; print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -769,7 +769,7 @@ if ($id > 0) $tableaushown=1; print ''; - print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'; + print ''; print ''; From 0a41a025aed155dfeaa94e83b78f348346f79925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:35:29 +0100 Subject: [PATCH 6/9] Update index.php --- htdocs/commande/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 0d2815a6d67..40b39ccb666 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -303,7 +303,7 @@ if (! empty($conf->commande->enabled)) print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')'; print ''; print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - print ''; + print ''; if ($num) { @@ -374,7 +374,7 @@ if (! empty($conf->commande->enabled)) print '
'.$langs->trans("OrdersToProcess").' ('.$num.')
'.$langs->trans("OrdersToProcess").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { From fb9f53010fc08af62a64f03f29996dc4f9052288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:36:38 +0100 Subject: [PATCH 7/9] Update index.php --- htdocs/fourn/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 9da28281779..29f12fed38f 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -126,7 +126,7 @@ if (! empty($conf->fournisseur->enabled)) { print '
'.$langs->trans("OnProcessOrders").' ('.$num.')
'.$langs->trans("OnProcessOrders").' '.$num.'
'; print ''; - print ''; + print ''; $i = 0; $var = true; @@ -183,7 +183,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { print '
'.$langs->trans("DraftOrders").' ('.$num.')
'.$langs->trans("DraftOrders").' '.$num.'
'; print ''; - print ''; + print ''; $i = 0; $tot_ttc = 0; $var = True; From 229f7888caac4b93638db34f8b2cff03bcc99f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 19 Jan 2015 20:38:33 +0100 Subject: [PATCH 8/9] Update index.php --- htdocs/comm/propal/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index de51cf63104..a0e8a3409ab 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -313,7 +313,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $var=true; print '
'.$langs->trans("DraftBills").' ('.$num.')
'.$langs->trans("DraftBills").' '.$num.'
'; - print ''; + print ''; $nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) @@ -399,7 +399,7 @@ if (! empty($conf->propal->enabled)) print '
'.$langs->trans("ProposalsOpened").' ('.$num.')
'.$langs->trans("ProposalsOpened").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { @@ -471,7 +471,7 @@ if (! empty($conf->propal->enabled)) print '
'.$langs->trans("ProposalsToProcess").' ('.$num.')
'.$langs->trans("ProposalsToProcess").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { From 3ab6ac601eb6ff3b6a1a7dcf713c3810a63ed29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Jan 2015 17:55:20 +0100 Subject: [PATCH 9/9] Type of supplier invoice was broken --- htdocs/core/class/commoninvoice.class.php | 42 +++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 991601a4fbd..6087a5a0adb 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -30,6 +30,36 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; */ abstract class CommonInvoice extends CommonObject { + /** + * Standard invoice + */ + const TYPE_STANDARD = 0; + + /** + * Replacement invoice + */ + const TYPE_REPLACEMENT = 1; + + /** + * Credit note invoice + */ + const TYPE_CREDIT_NOTE = 2; + + /** + * Deposit invoice + */ + const TYPE_DEPOSIT = 3; + + /** + * Proforma invoice + */ + const TYPE_PROFORMA = 4; + + /** + * Situation invoice + */ + const TYPE_SITUATION = 5; + /** * Return amount of payments already done * @@ -145,12 +175,12 @@ abstract class CommonInvoice extends CommonObject function getLibType() { global $langs; - if ($this->type == Facture::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); - if ($this->type == Facture::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); - if ($this->type == Facture::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); - if ($this->type == Facture::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); - if ($this->type == Facture::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); - if ($this->type == Facture::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); + if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); + if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); + if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); + if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); + if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); + if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); return $langs->trans("Unknown"); }
'.$langs->trans("OnProcessOrders").' ('.$num.')
'.$langs->trans("OnProcessOrders").' '.$num.'