Merge pull request #188 from FHenry/develop

Develop
This commit is contained in:
Regis Houssin 2012-04-30 05:33:48 -07:00
commit 79f2781bdb
11 changed files with 83 additions and 21 deletions

View File

@ -34,6 +34,8 @@ if (!$user->admin)
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
/* /*
* Actions * Actions
*/ */
@ -45,13 +47,34 @@ if ($action == 'setvalue' && $user->admin)
$mailfrom = GETPOST('MAILING_EMAIL_FROM','alpha'); $mailfrom = GETPOST('MAILING_EMAIL_FROM','alpha');
$mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha'); $mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha');
$checkread = GETPOST('value','alpha'); $checkread = GETPOST('value','alpha');
$checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY','alpha');
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
$res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
//$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",$checkread,'chaine',0,'',$conf->entity); if ($checkread=='on')
//if (! $res > 0) $error++; {
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",1,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
else if ($checkread=='off')
{
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE",0,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
//Create temporary encryption key if nedded
if (($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1) && (empty($checkread_key)))
{
$chars = "abcdef(ghijklmnopqrstuvwxyz;!ABCDEFGH,IJKLMNOPQRSTUVWXYZ01_23456789";
mt_srand(10000000*(double)microtime());
for ($i = 0, $str = '', $lc = strlen($chars)-1; $i < 30; $i++) {
$checkread_key .= $chars[mt_rand(0, $lc)];
}
}
$res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
@ -104,24 +127,31 @@ print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail")); if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
print '</td></tr>'; print '</td></tr>';
/*
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckRead").'</td><td>'; print $langs->trans("ActivateCheckRead").'</td><td>';
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1) if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=0">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=off">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
$readonly='';
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=1">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&value=on">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>'; print '</a>';
$readonly='disabled="disabled"';
} }
print '</td></tr>'; print '</td></tr>';
*/
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("ActivateCheckReadKey").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_UNSUBSCRIBE_KEY" '.$readonly.' value="'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'">';
print '</td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>'; print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';

View File

@ -64,7 +64,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
$substitutionarray, $substitutionarray,
array( array(
'__CHECK_READ__' => 'CheckMail', '__CHECK_READ__' => 'CheckMail',
'__UNSUSCRIBE__' => 'Unsuscribe' '__UNSUSCRIBE__' => 'Unsubscribe'
) )
); );
} }
@ -89,7 +89,7 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
$substitutionarrayfortest, $substitutionarrayfortest,
array( array(
'__CHECK_READ__' => 'TESTCheckMail', '__CHECK_READ__' => 'TESTCheckMail',
'__UNSUSCRIBE__' => 'TESTCheckMail' '__UNSUSCRIBE__' => 'TESTUnsubscribe'
) )
); );
} }

View File

@ -143,6 +143,8 @@ class MailingTargets // This can't be abstract as it is used for some method
*/ */
function add_to_target($mailing_id, $cibles) function add_to_target($mailing_id, $cibles)
{ {
global $conf;
$this->db->begin(); $this->db->begin();
// Insert emailing targest from array into database // Insert emailing targest from array into database
@ -162,7 +164,10 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= "'".$this->db->escape($cibles[$i]['other'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['other'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['source_url'])."',";
$sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',"; $sql .= "'".$this->db->escape($cibles[$i]['source_id'])."',";
$sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id))."',"; if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE==1)
{
$sql .= "'".$this->db->escape(md5($cibles[$i]['email'].';'.$cibles[$i]['name'].';'.$mailing_id.';'.$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY))."',";
}
$sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')"; $sql .= "'".$this->db->escape($cibles[$i]['source_type'])."')";
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)

View File

@ -77,6 +77,7 @@ CheckRead=Read Receipt
YourMailUnsubcribeOK=The email <b>%s</b> is correctly unsubcribe from mailing list YourMailUnsubcribeOK=The email <b>%s</b> is correctly unsubcribe from mailing list
MailtoEMail=Hyper link to email MailtoEMail=Hyper link to email
ActivateCheckRead=Activate Read receipt and unsubcribe tag ActivateCheckRead=Activate Read receipt and unsubcribe tag
ActivateCheckReadKey=Key use to encrypt URL use for Read Receipt and unsubcribe function
# Libelle des modules de liste de destinataires mailing # Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...) MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...)

View File

@ -85,6 +85,10 @@ TaskIsNotAffectedToYou=Task not allocated to you
ErrorTimeSpentIsEmpty=Time spent is empty ErrorTimeSpentIsEmpty=Time spent is empty
ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent. ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (<b>%s</b> tasks at the moment) and all inputs of time spent.
IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties. IfNeedToUseOhterObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties.
CloneProject=Clone project (associated task will be duplicated too)
ConfirmCloneProject=Are you sure to clone this project ?
ProjectReportDate=Change task date according project start date
ErrorShiftTaskDate=Impossible to shift task date according to new project start date
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Project leader TypeContact_project_internal_PROJECTLEADER=Project leader
TypeContact_project_external_PROJECTLEADER=Project leader TypeContact_project_external_PROJECTLEADER=Project leader

View File

@ -77,6 +77,7 @@ CheckRead=Accusé de lecture
YourMailUnsubcribeOK=L'adresse e-mail <b>%s</b> est bien désincrite de la liste. YourMailUnsubcribeOK=L'adresse e-mail <b>%s</b> est bien désincrite de la liste.
MailtoEMail=Ecrire a e-mail (lien) MailtoEMail=Ecrire a e-mail (lien)
ActivateCheckRead=Activer les tags d'accusé de lecture et de désincription ActivateCheckRead=Activer les tags d'accusé de lecture et de désincription
ActivateCheckReadKey=Clef de sécurité utilisée pour l'encryption des URL utilisées dans les fonctions d'accusé de lecture et de désincription
# Libelle des modules de liste de destinataires mailing # Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts de tiers (prospects, clients, fournisseurs...) MailingModuleDescContactCompanies=Contacts de tiers (prospects, clients, fournisseurs...)

View File

@ -85,6 +85,10 @@ TaskIsNotAffectedToYou=Tâche qui ne vous est pas affectée
ErrorTimeSpentIsEmpty=Le temps consommé n'est pas renseigné ErrorTimeSpentIsEmpty=Le temps consommé n'est pas renseigné
ThisWillAlsoRemoveTasks=Cette opération détruira également les tâches du projet (<b>%s</b> tâches actuellement) et le suivi des consommés. ThisWillAlsoRemoveTasks=Cette opération détruira également les tâches du projet (<b>%s</b> tâches actuellement) et le suivi des consommés.
IfNeedToUseOhterObjectKeepEmpty=Si des objets (facture, commande, ...), appartenant à un autre tiers que celui choisi, doivent être liés au projet à créer, laisser vide afin de laisser le projet multi-tiers. IfNeedToUseOhterObjectKeepEmpty=Si des objets (facture, commande, ...), appartenant à un autre tiers que celui choisi, doivent être liés au projet à créer, laisser vide afin de laisser le projet multi-tiers.
CloneProject=Cloner le projet (les taches associées sont dupliquées également)
ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ?
ProjectReportDate=Reporter les dates des taches en fonction de la date de départ.
ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des taches.
##### Types de contacts ##### ##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Chef de projet TypeContact_project_internal_PROJECTLEADER=Chef de projet
TypeContact_project_external_PROJECTLEADER=Chef de projet TypeContact_project_external_PROJECTLEADER=Chef de projet

View File

@ -52,7 +52,7 @@ class Project extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $DB Database handler
*/ */
function __construct($db) function __construct($db)
{ {
@ -707,7 +707,7 @@ class Project extends CommonObject
{ {
global $user, $langs, $conf; global $user, $langs, $conf;
$now = dol_now(); $now = mktime();
// Charge tableau des produits prodids // Charge tableau des produits prodids
$prodids = array(); $prodids = array();

View File

@ -64,7 +64,7 @@ class Task extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $DB Database handler
*/ */
function __construct($db) function __construct($db)
{ {
@ -305,6 +305,7 @@ class Task extends CommonObject
*/ */
function delete($user, $notrigger=0) function delete($user, $notrigger=0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -391,7 +392,7 @@ class Task extends CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }

View File

@ -246,6 +246,7 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
} }
} }
if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes') if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes')
{ {
$project = new Project($db); $project = new Project($db);
@ -315,6 +316,24 @@ if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confi
} }
} }
if ($action == 'confirm_clone' && $user->rights->projet->creer && GETPOST('confirm') == 'yes')
{
$idtoclone=$id;
$project = new Project($db);
$project->fetch($idtoclone);
$result=$project->createFromClone($idtoclone,true,true,true,true);
if ($result <= 0)
{
$mesg='<div class="error">'.$project->error.'</div>';
}
else
{
$id=$result;
$action='edit';
$comefromclone=true;
}
}
/* /*
* View * View
@ -353,7 +372,7 @@ if ($action == 'create' && $user->rights->projet->creer)
{ {
require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php"); require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php");
$modProject = new $obj; $modProject = new $obj;
$defaultref = $modProject->getNextValue($soc,$project); $defaultref = $modProject->getNextValue($soc,$project);
} }
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
@ -459,6 +478,7 @@ else
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1); $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Clone confirmation // Clone confirmation
if ($action == 'clone') if ($action == 'clone')
{ {
@ -486,9 +506,7 @@ else
// Customer // Customer
print '<tr><td>'.$langs->trans("Company").'</td><td>'; print '<tr><td>'.$langs->trans("Company").'</td><td>';
$text=$form->select_company($project->societe->id,'socid','',1,1); print $form->select_company($project->societe->id,'socid','',1,1);
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
print '</td></tr>'; print '</td></tr>';
// Visibility // Visibility
@ -562,7 +580,7 @@ else
// Date start // Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print dol_print_date($project->date_start,'day'); print dol_print_date($project->date_start,'day');
print '</td></tr>'; print '</td></tr>';
// Date end // Date end

View File

@ -125,7 +125,6 @@ if (! empty($project_ref) && ! empty($withproject))
} }
} }
// Find upload dir after retreive is task if necessary
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)
@ -141,7 +140,6 @@ if ($id > 0 || ! empty($ref))
dol_print_error($db); dol_print_error($db);
} }
} }
/* /*
* View * View
*/ */
@ -283,4 +281,4 @@ else
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>