Answers.Body: <p>I have rewritten the code found in this thread <a href="https://forum.civicrm.org/index.php?topic=19322.0" rel="nofollow noreferrer">https://forum.civicrm.org/index.php?topic=19322.0</a>
  'Collins22' chicago-orienteering.org/civicrm_code.htm</p>
  
  <p>to suit my specific purposes.  It isn't a civicrm extension nor uses API so far from architecturally pure, but it can be run as a php cron job so does the what is needed.  </p>
  
  <p>I have published the code on github <a href="https://github.com/alanef/civicrm-contribs-to-membership" rel="nofollow noreferrer">https://github.com/alanef/civicrm-contribs-to-membership</a> maybe it is of use to others - maybe some one wants to contribute and write it properly.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-21T17:24:14.940Z
Answers.LastActivityDate: 2017-03-21T17:44:02.823Z
Answers.LastEditDate: 2017-03-21T17:44:02.823Z
Answers.UserDisplayName: Alan Fuller
Body: <p>I expect this is a common problem, </p>
  
  <p>Treasurer get loads on contributions in CSV format ( Contact ID / Amount / Date )</p>
  
  <p>Bulk loading contributions via CSV is completely detached from membership renewal.</p>
  
  <p>As memberships are set to go 'grace' on expiry I think a script like</p>
  
  <p>Search membership in grace
  If contribution made and receipt date > membership expiry date
     set membership status to current , 
     set expiry to end next period, 
     link contribution to membership</p>
  
  <p>I don't think this is too challenging in SQL  ( I haven't looked at API ing it )</p>
  
  <p>So now the question,  there are batch jobs - how are they created / structured ?</p>
  
Tags: <civimember><contributions>
Title: Writing ( and publishing ) Batch Job
ThreadText: # Writing ( and publishing ) Batch Job
  
  (Asked by: username_0 on 2017-03-16)
  
  I expect this is a common problem,
  
  Treasurer get loads on contributions in CSV format ( Contact ID / Amount / Date )
  
  Bulk loading contributions via CSV is completely detached from membership renewal.
  
  As memberships are set to go 'grace' on expiry I think a script like
  
  Search membership in grace
  If contribution made and receipt date > membership expiry date
  set membership status to current ,
  set expiry to end next period,
  link contribution to membership
  
  I don't think this is too challenging in SQL ( I haven't looked at API ing it )
  
  So now the question, there are batch jobs - how are they created / structured ?
  
  **Tags:** civimember, contributions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-03-21. Score: 1
  
  I have rewritten the code found in this thread <https://forum.civicrm.org/index.php?topic=19322.0>
  'Collins22' chicago-orienteering.org/civicrm\_code.htm
  
  to suit my specific purposes. It isn't a civicrm extension nor uses API so far from architecturally pure, but it can be run as a php cron job so does the what is needed.
  
  I have published the code on github <https://github.com/alanef/civicrm-contribs-to-membership> maybe it is of use to others - maybe some one wants to contribute and write it properly.
  
  
  ---
  
  