Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
09d20bcf
Valider
09d20bcf
rédigé
11 years ago
par
mattab
Parcourir les fichiers
Options
Téléchargements
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
36fff3b0
c18171d4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
plugins/MobileMessaging/API.php
+15
-39
15 ajouts, 39 suppressions
plugins/MobileMessaging/API.php
plugins/ScheduledReports/ScheduledReports.php
+43
-0
43 ajouts, 0 suppression
plugins/ScheduledReports/ScheduledReports.php
avec
58 ajouts
et
39 suppressions
plugins/MobileMessaging/API.php
+
15
−
39
Voir le fichier @
09d20bcf
...
...
@@ -14,7 +14,6 @@ use Piwik\Common;
use
Piwik\Option
;
use
Piwik\Piwik
;
use
Piwik\Plugins\MobileMessaging\SMSProvider
;
use
Piwik\Plugins\ScheduledReports\API
as
APIScheduledReports
;
/**
* The MobileMessaging API lets you manage and access all the MobileMessaging plugin features including :
...
...
@@ -208,44 +207,21 @@ class API extends \Piwik\Plugin\API
unset
(
$phoneNumbers
[
$phoneNumber
]);
$this
->
savePhoneNumbers
(
$phoneNumbers
);
// remove phone number from reports
$APIScheduledReports
=
APIScheduledReports
::
getInstance
();
$reports
=
$APIScheduledReports
->
getReports
(
$idSite
=
false
,
$period
=
false
,
$idReport
=
false
,
$ifSuperUserReturnOnlySuperUserReports
=
$this
->
getDelegatedManagement
()
);
foreach
(
$reports
as
$report
)
{
if
(
$report
[
'type'
]
==
MobileMessaging
::
MOBILE_TYPE
)
{
$reportParameters
=
$report
[
'parameters'
];
$reportPhoneNumbers
=
$reportParameters
[
MobileMessaging
::
PHONE_NUMBERS_PARAMETER
];
$updatedPhoneNumbers
=
array
();
foreach
(
$reportPhoneNumbers
as
$reportPhoneNumber
)
{
if
(
$reportPhoneNumber
!=
$phoneNumber
)
{
$updatedPhoneNumbers
[]
=
$reportPhoneNumber
;
}
}
if
(
count
(
$updatedPhoneNumbers
)
!=
count
(
$reportPhoneNumbers
))
{
$reportParameters
[
MobileMessaging
::
PHONE_NUMBERS_PARAMETER
]
=
$updatedPhoneNumbers
;
// note: reports can end up without any recipients
$APIScheduledReports
->
updateReport
(
$report
[
'idreport'
],
$report
[
'idsite'
],
$report
[
'description'
],
$report
[
'period'
],
$report
[
'hour'
],
$report
[
'type'
],
$report
[
'format'
],
$report
[
'reports'
],
$reportParameters
);
}
}
}
/**
* Triggered after a phone number has been deleted. This event should be used to clean up any data that is
* related to the now deleted phone number. The ScheduledReports plugin, for example, uses this event to remove
* the phone number from all reports to make sure no text message will be sent to this phone number.
*
* **Example**
*
* public function deletePhoneNumber($phoneNumber)
* {
* $this->unsubscribePhoneNumberFromScheduledReport($phoneNumber);
* }
*
* @param string $phoneNumber The phone number that was just deleted.
*/
Piwik
::
postEvent
(
'MobileMessaging.deletePhoneNumber'
,
array
(
$phoneNumber
));
return
true
;
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
plugins/ScheduledReports/ScheduledReports.php
+
43
−
0
Voir le fichier @
09d20bcf
...
...
@@ -82,6 +82,7 @@ class ScheduledReports extends \Piwik\Plugin
'Menu.Top.addItems'
=>
'addTopMenu'
,
'TaskScheduler.getScheduledTasks'
=>
'getScheduledTasks'
,
'AssetManager.getJavaScriptFiles'
=>
'getJsFiles'
,
'MobileMessaging.deletePhoneNumber'
=>
'deletePhoneNumber'
,
'ScheduledReports.getReportParameters'
=>
'getReportParameters'
,
'ScheduledReports.validateReportParameters'
=>
'validateReportParameters'
,
'ScheduledReports.getReportMetadata'
=>
'getReportMetadata'
,
...
...
@@ -381,6 +382,48 @@ class ScheduledReports extends \Piwik\Plugin
}
}
public
function
deletePhoneNumber
(
$phoneNumber
)
{
$api
=
API
::
getInstance
();
$reports
=
$api
->
getReports
(
$idSite
=
false
,
$period
=
false
,
$idReport
=
false
,
$ifSuperUserReturnOnlySuperUserReports
=
APIMobileMessaging
::
getInstance
()
->
getDelegatedManagement
()
);
foreach
(
$reports
as
$report
)
{
if
(
$report
[
'type'
]
==
MobileMessaging
::
MOBILE_TYPE
)
{
$reportParameters
=
$report
[
'parameters'
];
$reportPhoneNumbers
=
$reportParameters
[
MobileMessaging
::
PHONE_NUMBERS_PARAMETER
];
$updatedPhoneNumbers
=
array
();
foreach
(
$reportPhoneNumbers
as
$reportPhoneNumber
)
{
if
(
$reportPhoneNumber
!=
$phoneNumber
)
{
$updatedPhoneNumbers
[]
=
$reportPhoneNumber
;
}
}
if
(
count
(
$updatedPhoneNumbers
)
!=
count
(
$reportPhoneNumbers
))
{
$reportParameters
[
MobileMessaging
::
PHONE_NUMBERS_PARAMETER
]
=
$updatedPhoneNumbers
;
// note: reports can end up without any recipients
$api
->
updateReport
(
$report
[
'idreport'
],
$report
[
'idsite'
],
$report
[
'description'
],
$report
[
'period'
],
$report
[
'hour'
],
$report
[
'type'
],
$report
[
'format'
],
$report
[
'reports'
],
$reportParameters
);
}
}
}
}
public
function
getReportRecipients
(
&
$recipients
,
$reportType
,
$report
)
{
if
(
self
::
manageEvent
(
$reportType
))
{
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter